-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
Renaming ROM::CommandRegistry#as
to #map_to
#235
Comments
@co, actually the mapper can map data without any model at all -- to pure hash. That's why naming it after the model is not a good idea. Instead, you can explicitly define the name of the mapper: class TaskMapper < ROM::Mapper
relation :tasks
register_as :mapper_name
model Task
end then rom.relation(:tasks).as(:mapper_name) |
@nepalez I don't think the confusion is in the naming of the mapper, but that rom.relation(:tasks).as(:tasks)
# as opposed to
rom.relation(:tasks).map_to(:tasks)
# or even
rom.relation(:tasks).mapper(:tasks) |
I see. As for me, I feel conformed with |
I agree that documentation is immensely useful, but it's better when the code is clear without it. Both are needed 😄 |
On Thu, May 21, 2015 at 4:32 PM Caleb Wright notifications@github.com
|
@solnic good to know. I personally like |
btw you can pass multiple mapper names there ie |
eh, I actually prefer |
me too, it reads nice imo just like you said. I guess we need to make a decision and stick to just one for 1.0.0 :) |
I prefer For example, Sequel aliases |
The way I read At the end of the day, I'll follow the consensus. I've been a ruby dev for a number of years, but am new to rom-rb and just wanted to surface some things that may be difficult for newcomers :) |
Let's see what people prefer and decide for 1.0.0 how it should be named. Closing this for now. |
Sounds like a plan. Thanks everyone for the feedback! |
One of the things that's confusing as a new ROM user is that
#as
is used with a mapper. From the TODO example —When I run —
It's not clear what the second
:tasks
is or where it comes from.I would like to recommend it be renamed to be more descriptive like
map_to
. Open to other ideas.The text was updated successfully, but these errors were encountered: