Rails - Value Checking
These are all options posted to me:
- return [] unless myvalue
- return unless arguments.all? - 'arguments.all?' will return true if and only if none of the collection members is false or nil. - If an argument can be false, you could do this: return unless arguments.all? { |arg| !arg.nil? }
- raise ArgumentError, "Parameter X is required" if x.blank?
 
 
 Posts
Posts
 
 
No comments:
Post a Comment