[Solved] Rails ActiveRecord methods in different places [closed]


You can do something like this :

if ..something..
  @posts = Post.where(..something..)
else
  @posts = Post.where(..something..)
end

@posts = @posts.all(:order => ..something..)

It’s better to do this, in Rails 3 :

@posts = @posts.order(..something..)

1

solved Rails ActiveRecord methods in different places [closed]