On 19 Oct 2007, at 09:04, GA Gorter wrote:
>
> How can i make a variable in find my code is
>
> @gardens = Garden.find(:all, :conditions => { :user_id => 1})
>
> The number 1 must be a variable of user.id so you only get the stuff
> placed by the user logged in at the moment
Not sure I get the question. What''s wrong with?
@gardens = Garden.find(:all, :conditions => { :user_id => user.id})
Ideally user would has_many :gardens, then you can just do
@gardens = user.gardens.
Fred
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---