SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Partials

  1. #1
    SitePoint Zealot
    Join Date
    May 2007
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question SOLVED Partials

    Hello Folks,

    I have the code below:

    show_cars.rhtml
    Code:
    Code Ruby:
    <%= render (:partial => "cars", :collection => @car_list)%>
    _cars.rhtml
    Code:
    Code Html:
    	<tr>
    		<td class="fourElements"><%= car.name%></td>
    		<td class="fourElements"><%= car.color%></td>
    		<td class="fourElements"><%= car.year%></td>
    		<td class="fourElements"><%= car.hp%></td>
    	</tr>
    car_controller.rb
    Code:
    Code Ruby:
    	def show_cars
                 @car_list = Car.find_cars_for_display
           end

    But when I try to load the page I have this error within the partial undefined local variable or method `car


    Where is the mistake ??? I can't find it.


    Thanks
    Last edited by macsig; Oct 14, 2007 at 18:28.
    Alla prossima ...

  2. #2
    SitePoint Zealot
    Join Date
    May 2007
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    solved
    the problem was within the partial
    Alla prossima ...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •