Re: render => partial not recognizing method in call

akkdio
Tue, 12 Jun 2012 19:55:32 -0000

> > Perhaps it is something basic as a beginner I am.  I have the
following:
>
> There was no need to show all this code, it is easier for us to see
> what is going on if you just show the relevant bits
>
> Understand and thanks.

> > [snip]
>
> >
> > I want the following partial to be shown in the Main#Welcome view:
> >
> > partial is located in the composer view folder:
> >
> > Editions List
> >
> > <% @composer.editions.map do |edition| %> #line 3 in error below
> > [snip]
> >
> > My limited knowledge believes the call to the partial should work and
> indeed
> > it does if done like this within the Composer#Show view:
> >
> > <%= render "edition" %>
> >
> > However, when I make the partial call from the Main#Welcome view like
> this:
> > The Main#Welcome view:
> > <%= render :partial => "composers/edition" %>
> >
> > It results in this error:
> >
> > NoMethodError in Main#welcome
> >
> > Showing
> >
>
/Users/akkdio/railsapps/rails_3/ruby_for_rails/r4r_music/r4r_music1/app/views/composers/_edition.html.erb
>
> > where line #3 raised:
> >
> > undefined method `editions'' for nil:NilClass
>
> That means that @composer is nil, since that is the object on which
> ''editions'' is being called.
>
> Have a look at the Rails Guide on Layouts and Rendering, particularly
> the section Using Partials to see how to pass local variables to the
> partial.
>
> Also have a look at the guide on debugging to get ideas on how to
> debug your code so that you can work out what is going on.
>

Will check this. thanks.

>
> I notice that you have asked for help twice before on this list and
> neither time did you reply to the suggestions offered or report
> whether you had found a solution. :(
>

Not an excuse but I was not notified of the someone answering... Sorry.
This time I checked back and check "email updates to me" Sorry again -
I
appreciate all the guidance i can get.

>
> Colin
>

--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To view this discussion on the web visit