Some resources:
I was wrong. It's accepts_nested_attributes_for <http://apidock.com/rails/ActiveRecord/NestedAttributes/ClassMethods/accepts_nested_attributes_for>. Sorry, case of not having Google available to me.

http://asciicasts.com/episodes/196-nested-model-form-part-1

http://asciicasts.com/episodes/197-nested-model-form-part-2

http://robots.thoughtbot.com/accepts-nested-attributes-for-with-has-many-through

http://railscasts.com/episodes/196-nested-model-form-part-1

This should help you with your problem. You need to do nested resources...it's the right thing to do. PS railscasts is a handy resource to have at hand. Ryan Bates needs to start doing them again!

--rob



On 01/15/2015 01:21 PM, Robby O'Connor wrote:

Nested resource is the way to go.

--Rob
Sent from my cell, please excuse any typos.

On Jan 15, 2015 1:15 PM, "Scott Ribe" <scott_r...@elevated-dev.com <mailto:scott_r...@elevated-dev.com>> wrote:

    On Jan 15, 2015, at 11:03 AM, Diego Dillenburg Bueno
    <diegodillenb...@gmail.com <mailto:diegodillenb...@gmail.com>> wrote:
    >
    > For now I had solved this issue storing the patient_id in the
    session, any information on this solution?

    That sounds like a bad idea. What if the user has more than one
    window open, or manages to use the back button to get to a
    hospitalization for a different patient?

    I'd think that patient_id for a new hospitalization ought to go
    into a hidden field in the form.

    --
    Scott Ribe
    scott_r...@elevated-dev.com <mailto:scott_r...@elevated-dev.com>
    http://www.elevated-dev.com/
    (303) 722-0567 <tel:%28303%29%20722-0567>Â voice




    --
    You received this message because you are subscribed to the Google
    Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to rubyonrails-talk+unsubscr...@googlegroups.com
    <mailto:rubyonrails-talk%2bunsubscr...@googlegroups.com>.
    To post to this group, send email to
    rubyonrails-talk@googlegroups.com
    <mailto:rubyonrails-talk@googlegroups.com>.
    To view this discussion on the web visit
    
https://groups.google.com/d/msgid/rubyonrails-talk/702789B2-47B5-4543-A5A9-395ED59A56AB%40elevated-dev.com.
    For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/54B80FB7.6000207%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to