Monday, May 10, 2010

[Rails] Re: NilClass passed to partial view

Colin Law wrote:
> On 10 May 2010 13:49, Greg Raymond <lists@ruby-forum.com> wrote:
>> class Address< ActiveRecord::Base
>> <%= render :partial => "addresses/edit", :locals => { :shippingAddress
>> => @address} %>
>> It keeps saying : "undefined method `model_name' for NilClass:Class "
>> tried this :
>
> In the partial have you got something.model_name? If so then
> 'something' is nil.
>
> In the traceback when you get the error message you should be able to
> see the line that is failing.
>
> Colin
Thanks Colin for the fast answer :

In the partial I have the "standard" scaffolded code for my Address
class

So it's a "form_for @address" just like Rails 3 is generates....

so I don't understand why I can go to /addresses/1 and see the form but
I cant view the same info via a partial.
--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate