>>  Person.find(:all, :conditions => { :university => victoria_wellington })
>>
>>     
>
> I'm quite suspicious where you're using find_by_some_association,
> couldn't you be walking the associations back in the other direction.
>
> victoria_wellington.people
>   

Can you explain this some more?

Why does has_many acts as a named_scope and belongs_to not?

I think it would be nice to be able to do:

  Comment.university(boston).creator(current_user).commentable(post).all

Instead of:

   
Comment.find_all_by_university_id_and_creator_id_and_commentable_type_and_commentable_id(boston,
 
current_user, post.class.base_class.name.to_s, post.id)

It's main advantage would be that it allows easy formation of dynamic 
queries based on input:

    scope = Comment.scoped({:include => [:creator, :commentable]})
    scope = scope.commentable(post) if post
    scope = scope.university(params[:uni]) if params[:uni]
    scope = scope.creator(current_user) if params[:created_by_me] == "1"
    scope = scope.country(params[:country]) if params[:country]
    @comments = scope.all



Lawrence


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to