LED wrote in post #1053782:
> hi im new in Ruby on rails and currently working with a reservation
> system can anyone explain what is the difference between
> current_package = build_reservation_package(:package_id => package_id)
> abd
> current_package =reservation_package.build(:package_id => package_id)
> because i tried using the first one but no good but when i try the
> second it worked i think both are the same please correct me if im
> wrong thank

I understand the difference between the two builds as follows:
I am assuming you are using nested_attributes and if so then my 
understanding is that in your controller you will be building the 
reservation_package object so that your form has something to work with.
If you have a has_many association then your controller will use the 
reservation_packages.build option and if you are working with a 
belongs_to association then you will find that the 
build_reservation_package is what is called for.

I am new to rails as well, but that is what I have gleaned so far ... 
hope it helps.

-- 
Posted via http://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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to