Ruby on Rails: NameError with acts
I am a relatively new web programmer and I'm trying to add this code on top of the /omrails tutorial. I'm able to get the gem acts-as-taggable-on to work until I input this code in pins/index.html.erb:
<%= render 'pages/home' %>
<div id="pins">
<%= render @pins %>
<p>Tags: <%= pin.tag_list.map { |t| link_to t, tag_path(t) }.join(', ') %></p>
</div>
<%= will_paginate @pins %>
and this into routes.rb:
get 'tags/:tag', to: 'pins#index', as: :tag
resources :pins
root to: 'pins#index'
Am I doing something wrong or is this code obsolete in Rails 3 because I am worried I used an older example from the original RailsCast? I tried searching but didn't appear to come across the exact same issue. I receive a NameError in Pins#index going to line 5, which is the long line starting with the p-tag in the first chunk of code.
Any help would be appreciated.
Edit to replicate error message:
A link to an image of the error message on imgur because I do not have the reputation to post an image and am not sure how to best enter the error into stackoverflow.
Edit 2 to add Pins Controller index method:
def index
@pins = Pin.order("created_at desc").page(params[:page]).per_page(20)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @pins }
format.js
end
end
链接地址: http://www.djcxy.com/p/36012.html
上一篇: 允许使用行为重复标记