On 12 June 2012 13:09, akkdio <[email protected]> wrote: > 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 > [snip] > > I want the following partial to be shown in the Main#Welcome view: > > partial is located in the composer view folder: > > <h3>Editions List</h3> > <ul> > <% @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. 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. :( Colin -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

