uses resource_class instead of controller_name

This commit is contained in:
rgarcia
2015-09-28 20:46:18 +02:00
parent 75181e9cf4
commit 0074422977
3 changed files with 8 additions and 1 deletions

View File

@@ -62,7 +62,7 @@ module Commentable
end
def commentable_name
@commentable_name ||= controller_name.singularize
@commentable_name ||= resource_class.to_s.downcase.singularize
end
def commentable_model

View File

@@ -22,4 +22,8 @@ class DebatesController < ApplicationController
params.require(:debate).permit(:title, :description, :tag_list, :terms_of_service, :captcha, :captcha_key)
end
def resource_class
Debate
end
end

View File

@@ -22,4 +22,7 @@ class ProposalsController < ApplicationController
params.require(:proposal).permit(:title, :question, :summary, :description, :external_url, :video_url, :responsible_name, :tag_list, :terms_of_service, :captcha, :captcha_key)
end
def resource_class
Proposal
end
end