I have the following piece of code, where params[:sort] is a variable whose value is one of m's column.
eval "@movie = @movie.sort_by { |m| m.#{params[:sort]}}"
Basically I want to sort the array @movie according to the column specified. Is there any way to do this without eval?
var = f(var)is pretty dubious, why not create a new variable for the new value?