I do not understand why you are not using the query chain:
Movie.where('title LIKE ?', "a%").order(:title)
But even better, create a scope, as Michael Lynch said, it will increase code reuse.
Actually your code gives an obsolescence warning. You should check this in the terminal window of the Rails server. Although this works, it is not a good idea that it should not be canceled.
DEPARTMENT WARNING: The #find (: all) call has expired. Instead, call #all. You also used search options. They are also out of date. Please create an area, not use search parameters. (called from irb_binding at (irb): 1)
source share