On 18 April 2014 00:34, Juan Andres Rodriguez <enanosa...@gmail.com> wrote:
> I'am working on a project about a booking system for a hotel, i have the
> Client model and the Reservation model, the client has_many reservations and
> the reservation belongs_to :client.
>
> The problem si that when i want to create a new reservation, i want to be
> able to create a client in the same form...
> ...
>
> when i try to add a reservation, i complete the client fields_for but when
> the reservation is created, the client is equal to nil....

The first rule of debugging is always to identify which section is
going wrong.  First look log/development.log where you can see the
parameters passed to the controller.  If they look right then you can
start debugging the controller to see where the problem is (you can
use puts statements in the controller code to print data, which will
appear in the server terminal window).  If the parameters look wrong
then the problem is with the view, so then inspect the html to see if
that is correct, and so on.  Keep splitting the problem down so you
identify a smaller and smaller area where the problem may be.  As I
said, this is a fundamental technique of debugging.

Colin

-- 
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/CAL%3D0gLuZkhzee99Miihp6kjsM5bwfhFcp7%2Bznkq143iV%3DSOgLg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to