> I was thinking more along the lines of
> @baby_names = BabyName.find( :all, :conditions => { user_id =>
> current_user.id } )
> to get all of them, or
> 
> @baby_name = BabyName.find(params[:id], :conditions => { user_id =>
> current_user.id }) if params[:id]

Hi all, I actually couldn't get this approach to work so I did something 
which I think amounts to the same thing, potentially better?

For the actions where I just need one baby name, e.g. show - I do this.

@baby_name = current_user.baby_names.find(params[:id])

For the actions where I need many baby names, e.g. index - I do this.

@baby_names_boys = current_user.baby_names.boys(:order => 'position')

Just want to check that's an ok way to do it (perhaps it's the best way 
to do it) before I work on moving them to named_scopes in the model?
-- 
Posted via http://www.ruby-forum.com/.

-- 
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