Created
September 5, 2014 17:05
-
-
Save travisdmathis/dd4cc73e220a624a9217 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Comment < ActiveRecord::Base | |
include ActsAsCommentable::Comment | |
belongs_to :commentable, :polymorphic => true | |
belongs_to :user | |
belongs_to :asset | |
default_scope :order => 'created_at DESC' | |
# NOTE: install the acts_as_votable plugin if you | |
# want user to vote on the quality of comments. | |
#acts_as_voteable | |
# NOTE: Comments belong to a user | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CommentsController < ApplicationController | |
def create | |
@asset = Asset.find(params[:id]) | |
comment = Comment.new(params[:comment].merge(:user_id => current_user.id, :commenter_name => current_user.full_name)) | |
unless @asset.comments.exists?(['comment LIKE?', "%#{comment.comment}%"]) && @asset.comments.exists?(['user_id LIKE?', "%#{current_user.id}%"]) || comment.comment.blank? | |
@asset.add_comment(comment) | |
end | |
end | |
def destroy | |
@comment = Comment.find(params[:comment_id]) | |
@comment.destroy | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Started DELETE "/files/242071/comments/1" for 127.0.0.1 at 2014-09-05 12:59:48 -0400 | |
AbstractController::ActionNotFound (The action 'destroy' could not be found for CommentsController): | |
actionpack (3.2.18) lib/abstract_controller/base.rb:116:in `process' | |
actionpack (3.2.18) lib/abstract_controller/rendering.rb:45:in `process' | |
actionpack (3.2.18) lib/action_controller/metal.rb:203:in `dispatch' | |
actionpack (3.2.18) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch' | |
actionpack (3.2.18) lib/action_controller/metal.rb:246:in `block in action' | |
actionpack (3.2.18) lib/action_dispatch/routing/route_set.rb:73:in `call' | |
actionpack (3.2.18) lib/action_dispatch/routing/route_set.rb:73:in `dispatch' | |
actionpack (3.2.18) lib/action_dispatch/routing/route_set.rb:36:in `call' | |
journey (1.0.4) lib/journey/router.rb:68:in `block in call' | |
journey (1.0.4) lib/journey/router.rb:56:in `each' | |
journey (1.0.4) lib/journey/router.rb:56:in `call' | |
actionpack (3.2.18) lib/action_dispatch/routing/route_set.rb:608:in `call' | |
omniauth (1.1.3) lib/omniauth/strategy.rb:177:in `call!' | |
omniauth (1.1.3) lib/omniauth/strategy.rb:157:in `call' | |
omniauth (1.1.3) lib/omniauth/builder.rb:48:in `call' | |
omniauth (1.1.3) lib/omniauth/strategy.rb:177:in `call!' | |
omniauth (1.1.3) lib/omniauth/strategy.rb:157:in `call' | |
omniauth (1.1.3) lib/omniauth/builder.rb:48:in `call' | |
newrelic_rpm (3.6.6.147) lib/new_relic/rack/error_collector.rb:43:in `call' | |
newrelic_rpm (3.6.6.147) lib/new_relic/rack/agent_hooks.rb:22:in `call' | |
newrelic_rpm (3.6.6.147) lib/new_relic/rack/browser_monitoring.rb:16:in `call' | |
warden (1.0.6) lib/warden/manager.rb:35:in `block in call' | |
warden (1.0.6) lib/warden/manager.rb:34:in `catch' | |
warden (1.0.6) lib/warden/manager.rb:34:in `call' | |
actionpack (3.2.18) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call' | |
rack (1.4.5) lib/rack/etag.rb:23:in `call' | |
rack (1.4.5) lib/rack/conditionalget.rb:35:in `call' | |
actionpack (3.2.18) lib/action_dispatch/middleware/head.rb:14:in `call' | |
actionpack (3.2.18) lib/action_dispatch/middleware/params_parser.rb:21:in `call' | |
actionpack (3.2.18) lib/action_dispatch/middleware/flash.rb:242:in `call' | |
rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context' | |
rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call' | |
actionpack (3.2.18) lib/action_dispatch/middleware/cookies.rb:341:in `call' | |
activerecord (3.2.18) lib/active_record/query_cache.rb:64:in `call' | |
activerecord (3.2.18) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call' | |
actionpack (3.2.18) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call' | |
activesupport (3.2.18) lib/active_support/callbacks.rb:405:in `_run__1984710737959277403__call__3715489614294105960__callbacks' | |
activesupport (3.2.18) lib/active_support/callbacks.rb:405:in `__run_callback' | |
activesupport (3.2.18) lib/active_support/callbacks.rb:385:in `_run_call_callbacks' | |
activesupport (3.2.18) lib/active_support/callbacks.rb:81:in `run_callbacks' | |
actionpack (3.2.18) lib/action_dispatch/middleware/callbacks.rb:27:in `call' | |
actionpack (3.2.18) lib/action_dispatch/middleware/reloader.rb:65:in `call' | |
actionpack (3.2.18) lib/action_dispatch/middleware/remote_ip.rb:31:in `call' | |
actionpack (3.2.18) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call' | |
actionpack (3.2.18) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call' | |
railties (3.2.18) lib/rails/rack/logger.rb:32:in `call_app' | |
railties (3.2.18) lib/rails/rack/logger.rb:16:in `block in call' | |
activesupport (3.2.18) lib/active_support/tagged_logging.rb:22:in `tagged' | |
railties (3.2.18) lib/rails/rack/logger.rb:16:in `call' | |
actionpack (3.2.18) lib/action_dispatch/middleware/request_id.rb:22:in `call' | |
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call' | |
rack (1.4.5) lib/rack/runtime.rb:17:in `call' | |
activesupport (3.2.18) lib/active_support/cache/strategy/local_cache.rb:72:in `call' | |
rack (1.4.5) lib/rack/lock.rb:15:in `call' | |
actionpack (3.2.18) lib/action_dispatch/middleware/static.rb:63:in `call' | |
railties (3.2.18) lib/rails/engine.rb:484:in `call' | |
railties (3.2.18) lib/rails/application.rb:231:in `call' | |
railties (3.2.18) lib/rails/railtie/configurable.rb:30:in `method_missing' | |
rack (1.4.5) lib/rack/builder.rb:134:in `call' | |
rack (1.4.5) lib/rack/urlmap.rb:64:in `block in call' | |
rack (1.4.5) lib/rack/urlmap.rb:49:in `each' | |
rack (1.4.5) lib/rack/urlmap.rb:49:in `call' | |
railties (3.2.18) lib/rails/rack/log_tailer.rb:17:in `call' | |
rack (1.4.5) lib/rack/content_length.rb:14:in `call' | |
railties (3.2.18) lib/rails/rack/log_tailer.rb:17:in `call' | |
rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service' | |
/Users/travis/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service' | |
/Users/travis/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run' | |
/Users/travis/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread' | |
Rendered /Users/travis/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/gems/1.9.1/gems/actionpack-3.2.18/lib/action_dispatch/middleware/templates/rescues/unknown_action.erb within rescues/layout (0.4ms) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
comments#destroy comment DELETE /files/:id/comments/:id(.:format) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment