誰かが私のためにこれに光を当てることができますか?
#の未定義のメソッド `first_name'
これがshow.htmlです
<p id="notice"><%= notice %></p>
<div id="container">
<p>
<b>First name:</b>
<%= @artist.firstname %>
</p>
<p>
<b>Second name:</b>
<%= @artist.surname %>
</p>
<p>
<b>About:</b>
<%= @artist.about %>
</p>
<div id="comments">
<h2>Comments</h2>
<%= render :partial => "shared/comment", :collection => @artist.comments%>
</div
</div>
<%= render :partial => "image", :collection => @artist.images %>
<%= link_to 'Edit', edit_artist_path(@artist) %> |
<%= link_to 'Back', artists_path %>
<%= link_to 'show', images_path %>
これが部分的です
<div class="comment">
<p>
<span class="commentator"><%= comment.commentator.display_name %>
say's</span>
<%= comment.comment %>
</p>
</div
これが友達ビューです
class Friends < ActiveRecord::Base
attr_accessible :firstname, :surname
has_many :comments, :as => :commentator, :class_name =>"Commentable"
def display_name
"#{self.firstname} #{self.surname}"
end
end
これは友達のコントローラーです
class FriendsController < ApplicationController
# GET /friends
# GET /friends.xml
def index
@friends = Friend.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @friends }
end
end
# GET /friends/1
# GET /friends/1.xml
def show
@friend = Friend.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @friend }
end
end
# GET /friends/new
# GET /friends/new.xml
def new
@friend = Friend.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @friend }
end
end
# GET /friends/1/edit
def edit
@friend = Friend.find(params[:id])
end
# POST /friends
# POST /friends.xml
def create
@friend = Friend.new(params[:friend])
respond_to do |format|
if @friend.save
format.html { redirect_to(@friend, :notice => 'Friend was successfully created.') }
format.xml { render :xml => @friend, :status => :created, :location => @friend }
else
format.html { render :action => "new" }
format.xml { render :xml => @friend.errors, :status => :unprocessable_entity }
end
end
end
# PUT /friends/1
# PUT /friends/1.xml
def update
@friend = Friend.find(params[:id])
respond_to do |format|
if @friend.update_attributes(params[:friend])
format.html { redirect_to(@friend, :notice => 'Friend was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @friend.errors, :status => :unprocessable_entity }
end
end
end
# DELETE /friends/1
# DELETE /friends/1.xml
def destroy
@friend = Friend.find(params[:id])
@friend.destroy
respond_to do |format|
format.html { redirect_to(friends_url) }
format.xml { head :ok }
end
end
end
友達がアーティストのページにコメントを残せるようにしようとしていますが、上記のエラーが発生し続けます。
私はRubyを初めて使用するので、何かを省略してしまったことをお詫びします。