On 3 Ott, 10:50, Peter De Berdt <[email protected]> wrote:
> On 02 Oct 2009, at 19:03, adedip wrote:
>
> >   @articles = Article.find(:all, :order => :date, :conditions =>
> > {:author => aut, :date.year => tf.year..tt.year})
>
>   �...@articles = Article.find(:all, :order => :date, :conditions =>
> ["(YEAR(date) BETWEEN ? AND ?) AND author_id=?",tf.year, tt.year,  
> aut.id])
>
> Just out of the top of my head.
>
> Best regards
>
> Peter De Berdt

Occam is always right... the easiest solution if often the best one :D
(parenthesys work)

morover..
when I use Article.scope(:all, ....
it still behave like an array..
Instead using Article.scoped_by it seems to work better.. but I guess
I can't do something like this:

 proxy = Article.scoped_by_author_and_date(aut,"YEAR(date) BETWEEN ?
AND ?",tf.year,tt,year)
  @articles = proxy.find_by_solr(params[:query]).results

in the server log I get this:
  Article Load (1.2ms)   SELECT * FROM `articles` WHERE (articles.id
in (1)) AND (`articles`.`date` = 'date BETWEEN ? AND ?' AND
`articles`.`author` = 'No Author')

the question marks comes out :S

I'm hopeless :D
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to