Skip to content

Instantly share code, notes, and snippets.

def delete_timeline_event
@video = Video.find(params[:id])
timeline_event = TimelineEvent.find_by_subject(@video)
timeline_event.destroy
end
def delete_timeline_event
timeline_event = TimelineEvent.find_by_subject(self)
timeline_event.destroy
end
Started GET "/comment_titles/225?_=1303337058911" for 127.0.0.1 at Wed Apr 20 15:04:18 -0700 2011
Processing by CommentTitlesController#show as JS
Parameters: {"id"=>"225", "_"=>"1303337058911"}
ActiveRecord::RecordNotFound (Couldn't find CommentTitle with ID=485):
app/controllers/videos_controller.rb:44:in `update'
def update
@video = current_user.videos.find(params[:id])
respond_to do |format|
if @video.update_attributes(params[:video])
format.html { redirect_to(@video) }
format.js
else
format.html { render :action => "edit" }
end
@comment_title = @video.comment_titles.last
ActionView::Template::Error (You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.to_key):
1: $("#<%= dom_id(@comment.comment_title) %>").parent().append('<%= escape_javascript(render(@comment)) %>');
2: $(".comment_form")[0].reset();
app/views/comments/create.js.erb:1:in `_app_views_comments_create_js_erb___503385093_2173588800_0'
app/controllers/comments_controller.rb:8:in `create'
%= f.association :comment_title, :collection => @video.comment_titles.map {|ct| [ct.title, comment_title_path(ct)] }, :label => "Comment Title:", :include_blank => false %>
<form accept-charset="UTF-8" action="/videos/485/comments" class="simple_form comment comment_form" data-remote="true" id="new_comment" method="post">
<div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓">
<input name="authenticity_token" type="hidden" value="uN9pEFR6ITTas2Uy1VCshCgt3CHV+9W7Oml5G19mJsU=">
</div>
<div class="input select optional comment_form">
<label class="select optional" for="comment_comment_title_id"> Comment Title:</label>
<select class="select optional" id="comment_comment_title_id" name="comment[comment_title_id]">
<option value="/comment_titles/265">dfvsdfvds</option>
<option value="/comment_titles/266">fesfsees</option>
</select>
:collection => @video.comment_titles.map {|ct| [ct.title, {:value => ct.id, :data_url => comment_title_path(ct)}]}