Gavin Morrice wrote:
> Hi,
>
> why not add a named scope to messages:
>
> named_scope :public, :conditions => {:public => true}
>
> So you can call either:
> user.messages
> messages.public
> or
> user.messages.public
>
> Is that what you're looking for?
>
> Also, I think the standard for join tables is to name them in
> alphabetical order, so messages_users.
>
> Gavin
>
> On Jun 21, 7:05�am, Alexander Trauzzi <rails-mailing-l...@andreas-
Hey, wow! That's really neat! I'm surprised I didn't read about this
in my ActiveRecord book. (I've only been skimming on a need-basis)
That's neat that you can combine them, *or* run chains of them.
So I've done a bit of online research about the named scopes, and I just
want to make sure that I'm not getting in any danger by starting to
write what may be some long named scope chains ;)
Knowing this, what I will end up doing (as my practical scenario is more
complicated than the example provided), is write several named scopes
and then tie them all together with one
"canRead/canWrite/canModify/canDelete/canCreate" named scope.
Obviously I'm heading in the direction of ACL here, but on a
per-instance level.
All suggestions and reactions are welcome :)
--
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
-~----------~----~----~----~------~----~------~--~---