Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support bare collections #3

Closed
jaylevitt opened this issue Sep 7, 2011 · 2 comments
Closed

Support bare collections #3

jaylevitt opened this issue Sep 7, 2011 · 2 comments

Comments

@jaylevitt
Copy link

Valium is a great idea. But my most frequent use case of .map(&:column) is across an entire collection, not a custom relation. Semantically, it'd be nicer if I could do these:

User[:name]
User.posts[:id]

Instead of this:

User.scoped[:name]
User.posts.scoped[:id]

I'm not sure this is possible, since a model (User) is just a Class, and an association collection is just an Array - I assume you need them to become an ActiveRecord::Relation. But if it's possible to monkey patch into this, it'd be sweet.

@ernie
Copy link
Owner

ernie commented Sep 7, 2011

Have you actually tried this? The first one works already.

The second one will work momentarily. :)

@ernie ernie closed this as completed in 2246ccb Sep 7, 2011
@jaylevitt
Copy link
Author

Wow, thanks for the quick fix! I thought I had tried both forms, but obviously missed something. They both work great now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants