我的管制人员有以下守则:
文件:控制器/控制器/控制器/控制器。
def show_snapshot_comments
snapshot = Snapshot.find(params[:id])
@photo = snapshot.photo
comments = snapshot.comments.paginate :page => params[:page]
@snapshot_comment = snapshot.comments.new
respond_to do |format|
format.js
end
end
The JavaScript (jQuery): File: app/views/photos/show_snapshot_comments.js.erb
$j( #info ).append("<%= escape_javascript(render :partial => "snapshot_comments",
:locals => {:snapshot => snapshot, :comments => comments}) %>" );
show_snapshot_copmments is called from: app/views/photos/show.html.erb
似乎没有工作。
我的错误:
发送照片/how_snapshot_com
ActionView::TemplateError (undefined local variable or method `snapshot for #<ActionView::Base:0x2aaaaea473c8>) on line #2 of app/views/photos/show_snapshot_comments.js.erb:
1: $j( #info ).append("<%= escape_javascript(render :partial => "snapshot_comments",
2: :locals => {:snapshot => snapshot, :comments => comments}) %>" );
app/views/photos/show_snapshot_comments.js.erb:2
app/controllers/photos_controller.rb:227:in `show_snapshot_comments
可能出现的任何想法?