Hi, I have a simple program that tries to do something really basic. First, I have a company Model : ------------------------------------- class Company < ActiveRecord::Base has_one :billingAddress, :foreign_key=>"id", :class_name=>"Address" end
Then I have the address Model : -------------------------------------- class Address< ActiveRecord::Base belongs_to :company end I've created manually an entry in the DB for Address and Company and I've linked them (Company table has a "billingAddress_id" row) In my views "company/_form"(scaffold generated), I want to display the address form. So I added (following Rails Guides) the following line to my view : <%= render :partial => "addresses/edit", :locals => { :shippingAddress => @address} %> It keeps saying : "undefined method `model_name' for NilClass:Class " tried this : <%= render :partial => "addresses/edit", :locals => { @company.shippingAddress => @address} %> with the same result I've tried with : <%= render :partial => "addresses/form", :object => @billingAddress%> and I got the same result (this is normal I think since I don't have a billingAddress object but a Company object. Finally, I've tried : <%= :partial => "addresses/form", :object => @company.shippingAddress %> and the error I got was : syntax error, unexpected tASSOC, expecting ') When I load the Company with rails console, it loads perfectly. However I cannot manage to call the aggregated object view since the name of the variable is not the same name as the class name... at least, that what I think it is :-) Can someone help me to figure this out ? I thought that this will be a simple task but it figures that it is not... Thank you very much for your time ! -- 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 rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.