If you use a hash instead of an array, it would be faster and cleaner. And, since your default is "most_recent"
, having "most_recent"
in valid_options
is redundant. You better remove it.
filter_options =
Hash.new("most_recent")
.merge("most_popular" => "most_popular", "most_active" => "most_active")
@my_param = filter_options[params[:my_param]]