I need to sort users by their rank how do I do this? -- Posted via http://www.ruby-forum.com/.
Mohammad Surname? wrote:> I need to sort users by their rank how do I do this?Assuming a User model with a comparable rank attribute, @users = User.find(:all :order => "rank" ) -- Ray
./script/../config/../app/controllers/users_controller.rb:12: parse error, unexpected '':'', expecting '')'' @users = Users.find(:all :order => "points" ) ^ ./script/../config/../app/controllers/users_controller.rb:12: parse error, unexpected '')'', expecting kEND ./script/../config/../app/controllers/users_controller.rb:51: parse error, unexpected $, expecting kEND this is the error I got when I ran it -- Posted via http://www.ruby-forum.com/.
On Sun, 2006-04-16 at 05:11 +0200, Mohammad Surname? wrote:> ./script/../config/../app/controllers/users_controller.rb:12: parse > error, unexpected '':'', expecting '')'' > @users = Users.find(:all :order => "points" ) > ^ > ./script/../config/../app/controllers/users_controller.rb:12: parse > error, unexpected '')'', expecting kEND > ./script/../config/../app/controllers/users_controller.rb:51: parse > error, unexpected $, expecting kEND > > this is the error I got when I ran it---- I would think that you would need a comma between :all and :order... @users = Users.find(:all, :order => "points" ) Craig
Craig White wrote:> On Sun, 2006-04-16 at 05:11 +0200, Mohammad Surname? wrote: >> ./script/../config/../app/controllers/users_controller.rb:12: parse >> error, unexpected '':'', expecting '')'' >> @users = Users.find(:all :order => "points" ) >> ^ >> ./script/../config/../app/controllers/users_controller.rb:12: parse >> error, unexpected '')'', expecting kEND >> ./script/../config/../app/controllers/users_controller.rb:51: parse >> error, unexpected $, expecting kEND >> >> this is the error I got when I ran it > ---- > I would think that you would need a comma between :all and :order... > > @users = Users.find(:all, :order => "points" )True. -- Ray
@users = Users.find(:all, :order => "points DESC" ) It has to have DESC at the end -- Posted via http://www.ruby-forum.com/.