Hi. I am often checking the same parameters (like param[:page] and param[:per_page]) in models over and over again (are those in a specific range ... if not use defaults): page = !options[:page].blank? && options[:page] =~ /^[0-9]+$/ && options[:page].to_i > 0 ? options[:page].to_i : 1 per_page = !options[:per_page].blank? && options[:per_page] =~ /^[0-9]+ $/ && options[:per_page].to_i > 0 && options[:per_page].to_i <= 100 ? options[:per_page].to_i : 10
How can I make this more DRY and easier to read? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.