Ruby on Rails Tuesday, March 1, 2011

On Mar 1, 4:49 pm, Fearless Fool <li...@ruby-forum.com> wrote:

>
> * (Curiosity:) How did render(... :collection) know about the newly
> created metered_service without an ID?  I know that
> premise.metered_services.build will create a new record, but it appears
> that the new record doesn't appear on the premises.metered_services list
> until it's saved.

build adds the record to the in memory collection
>
> * (Necessity:) Assume the user is looking at
> views/premises/edit.html.erb.  I want a button that says "add
> metered_service to the current premise".  What's the right way to do
> that?  (Clearly, I haven't made friends with form_for() just yet.)
>
There's a railscast covering one possible approach:
http://railscasts.com/episodes/197-nested-model-form-part-2

Fred
> TIA.
>
> - ff
>
> --
> Posted viahttp://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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment