1

I'm working on a rentals system. I have a model called check_outs which is a child of a rental order where an order has_many :check_outs and a check_out belongs_to :rental. My order accepts_nested_attributes_for :check_outs and I have a nested fields_for :check_outs. I'm using rbates' nested_form gem.

What I'm trying to do is get a property of the rental (description, an attr_accessor of check_outs), that was set in the checkout creation step, to populate a label or text field in the edit view.

I know I can get the check_out object it self using builder.object and I can even get builder.object.rental but when I try to get builder.object.rental.id or builder.object.rental.description I get an unknown attribute for nil error. This doesn't seem to make sense since the object itself is not nil.

Any ideas?

  • If I understand what you are doing properly, this should help: [http://stackoverflow.com/questions/2409638/fields-for-form-builder-object-is-nil][1] [1]: http://stackoverflow.com/questions/2409638/fields-for-form-builder-object-is-nil – Will Richardson Mar 24 '12 at 09:09
  • Both of the components in that post's solution are handled in my application. Additionally, that post doesn't really pertain to my problem. – user1282488 Mar 28 '12 at 18:16
  • Any progress on this? Having the same issue with Rails 4. – ricsrock Mar 28 '13 at 20:21

0 Answers0