Brilliant.  Okay, my grievances are really starting to melt away now.

On 6/19/07, Chris Wanstrath <[EMAIL PROTECTED]> wrote:
>
> First thing:
>
> class << ActiveRecord::Base
>   public :with_scope
> end
>
> Second thing:
>
> > * The first thing is that ideally this would be modelled by User
> > has_many :accessible_properties, but that is not possible because
> > accessible_properties does not have static conditions (they depend on
> > the instance, therefore they can't hardcoded with a class macro... if
> > there is a way around this please do tell).
>
> You can do this.  If you pass in a conditions string between single
> quotes, it will be interpolated by your instance.  That is:
>
> has_many :accessible_properties,
>   :class_name => 'Property',
>   :conditions => 'face_id = #{id}'
>
> #{id} will be the id of your object, not your class.  Dynamic.
>
> --
> Chris Wanstrath
> http://errfree.com // http://errtheblog.com
>
> >
>


-- 
Gabe da Silveira
http://darwinweb.net

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