I am using Ruby on Rails 3.2.2 and I am trying to shorten the following code:
custom_values.each do |custom_value|
raise("Error!") unless AVAILABLE_CUSTOM_VALUES.include?(custom_value)
end
There is a way to make that? If so, how can shorten (or, maybe, improve) the code?
Personally, I have no problem with the code you wrote, but you can shorten it like this: