(@products + @collections + @users + @questions).map do |r|
@results << {
:label => ["Product", "Collection", "User"].include?(r.class.name) ? r.name : r.question,
:category => r.class.name,
:href => eval("#{r.class.name.downcase}_path(r)")
}
end
I am currently looking if there is a way not to use eval on the string to convert it to a helper.
Note: This code is currently in the controller. Rails 2.3.11
Use
polymorphic_path