Displaying 2 results from an estimated 2 matches for "build_associ".
2012 Sep 13
0
Accepting build_association parameter for fields_for helper or build association object automatically
Do you think will it useful to include in rails functionality of this gem<https://github.com/ka8725/get_or_build>(get_or_build)?
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/6vNMq94gdb4J.
To post to this group, send email to
2012 Jul 28
1
`build_association` produces DB-queries
Let `User.has_one :profile`. I''ve always thought that `@user.build_profile`
is a cheap thing to do - it''s just creating a new object without persisting
it. But, in fact, it does 2 queries to the DB: `BEGIN` and `COMMIT`.
In my app I have an admin users#index page where users'' details can be
edited, and to simplify the code I build a profile whenever it''s