Re: [Rails] Re: Re: pattern findings using “find ” in Rails

2010-10-26 Thread PalaniKannan K
> > > > Palani Kannan. K, > > Impossible. > > You're defining author_yr in a ruby model, but expecting the DATABASE to > know what that is. Doesn't work that way. > > As Fred mentioned, you need to use a database function that looks at the > "author_year" field (the last 4 characters) to order upon

[Rails] Re: Re: pattern findings using “find” in Rails

2010-10-26 Thread Marnen Laibow-Koser
Ar Chron wrote in post #957266: > PalaniKannan K wrote in post #957235: >> >> I tried >> def author_yr >> "#{self.author_year.last(4)}" >> end. >> >> But it shows "Undefined local variable or method 'author_yr'" >> >> when i use author_yr in find by >> >> ":order => ["author_year like = ?", author

[Rails] Re: Re: pattern findings using “find” in Rails

2010-10-26 Thread Ar Chron
PalaniKannan K wrote in post #957235: > > I tried > def author_yr > "#{self.author_year.last(4)}" > end. > > But it shows "Undefined local variable or method 'author_yr'" > > when i use author_yr in find by > > ":order => ["author_year like = ?", author_yr]". Please suggest me some > idea > in ord

[Rails] Re: Re: pattern findings using “find” in Rails

2010-10-25 Thread Marnen Laibow-Koser
PalaniKannan K wrote in post #956892: > Hi Ar Chron, > > Thank you for reply > > On 25 October 2010 14:55, Ar Chron wrote: > >> Refactor the DB to have those fields available separately. You have two >> distinct pieces of data munged together in one field. >> > > I shouldn't edit or modify the da