Re: [Rails] Re: order by not ordering as expected...

2010-07-08 Thread Colin Law
On 7 July 2010 21:59, Robert Walker wrote: > RubyonRails_newbie wrote: >>  def comment >>     �...@blogcomment = Blogcomment.find(:all, :order => "created_at >> desc") > > I don't understand the point to this. See next comment... > >>       @user = User.find(session[:user_id]) > > Nor this... > >>

[Rails] Re: order by not ordering as expected...

2010-07-08 Thread Rob Nichols
RubyonRails_newbie wrote: > ah yes... :-) > > It is in the log: > > 0mSELECT * FROM `blogcomments` ORDER BY created_at desc LIMIT 1 > > So if it is in the log, why isn't it ordering the comments? 'LIMIT 1' at the end of that SQL query means that only one record is being returned. Either you ha

[Rails] Re: order by not ordering as expected...

2010-07-07 Thread Robert Walker
RubyonRails_newbie wrote: > def comment > @blogcomment = Blogcomment.find(:all, :order => "created_at > desc") I don't understand the point to this. See next comment... > @user = User.find(session[:user_id]) Nor this... > > Blogpost.find(params[:id]).blogcomments.create(params

Re: [Rails] Re: order by not ordering as expected...

2010-07-07 Thread Colin Law
On 7 July 2010 21:46, RubyonRails_newbie wrote: > ah yes... :-) > > It is in the log: > > 0mSELECT * FROM `blogcomments` ORDER BY created_at desc LIMIT 1 > > So if it is in the log, why isn't it ordering the comments? What is it that seems to not be sorted? @blogcomment should be sorted but you

[Rails] Re: order by not ordering as expected...

2010-07-07 Thread RubyonRails_newbie
ah yes... :-) It is in the log: 0mSELECT * FROM `blogcomments` ORDER BY created_at desc LIMIT 1 So if it is in the log, why isn't it ordering the comments? On 7 July, 21:42, Colin Law wrote: > On 7 July 2010 21:25, RubyonRails_newbie wrote: > > > Hmm, > > > for some reason the log isn't showi

Re: [Rails] Re: order by not ordering as expected...

2010-07-07 Thread Colin Law
On 7 July 2010 21:25, RubyonRails_newbie wrote: > Hmm, > > for some reason the log isn't showing the order by clause: > > Rendering blogposts/show >   [4;35;1mBlogcomment Load (0.4ms) [0m    [0mSELECT * FROM > `blogcomments` WHERE (`blogcomments`.blogpost_id = 17)  [0m >   [4;36;1mBlogcomment Colu

Re: [Rails] Re: order by not ordering as expected...

2010-07-07 Thread Jason Michael
that can't be - either your syntax is incorrect and it shows an error in the log and on the screen, or it is correct and it shows the SELECT with the ORDER clause. Your syntax appears to be correct, by the way. On Wed, Jul 7, 2010 at 3:30 PM, RubyonRails_newbie wrote: > what I mean is that the o

[Rails] Re: order by not ordering as expected...

2010-07-07 Thread RubyonRails_newbie
what I mean is that the orderby isn't been used. the latest entry in the log just shows the select query without the order by. On 7 July, 21:28, Jason Michael wrote: > it has to - it shows every query > > On Wed, Jul 7, 2010 at 3:25 PM, RubyonRails_newbie > > > > wrote: > > Hmm, > > > for some

Re: [Rails] Re: order by not ordering as expected...

2010-07-07 Thread Jason Michael
it has to - it shows every query On Wed, Jul 7, 2010 at 3:25 PM, RubyonRails_newbie wrote: > Hmm, > > for some reason the log isn't showing the order by clause: > > Rendering blogposts/show >   [4;35;1mBlogcomment Load (0.4ms) [0m    [0mSELECT * FROM > `blogcomments` WHERE (`blogcomments`.blogpos

[Rails] Re: order by not ordering as expected...

2010-07-07 Thread RubyonRails_newbie
Hmm, for some reason the log isn't showing the order by clause: Rendering blogposts/show [4;35;1mBlogcomment Load (0.4ms) [0m[0mSELECT * FROM `blogcomments` WHERE (`blogcomments`.blogpost_id = 17) [0m [4;36;1mBlogcomment Columns (1.3ms) [0m[0;1mSHOW FIELDS FROM `blogcomments` [0m C