diff --git a/app/controllers/beispiele_controller.rb b/app/controllers/beispiele_controller.rb index ee8390e..7c75fa5 100755 --- a/app/controllers/beispiele_controller.rb +++ b/app/controllers/beispiele_controller.rb @@ -3,6 +3,7 @@ class BeispieleController < ApplicationController load_and_authorize_resource include LikeVoteable + acts_as_flagable def index @beispiele = Beispiel.all diff --git a/config/routes.rb b/config/routes.rb index 7a522f8..dd339d5 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -73,6 +73,7 @@ member do get 'like' get 'dislike' + get 'flag' end end resources :lvas do diff --git a/lib/flagable.rb b/lib/flagable.rb new file mode 100644 index 0000000..882562e --- /dev/null +++ b/lib/flagable.rb @@ -0,0 +1,25 @@ +module Flagable + module ActsAsFlagable + extend ActiveSupport::Concern + included do + + end + module ClassMethods + def acts_as_flagable(options={}) + include Flagable::ActsAsFlagable::LocalInstanceMethods + #extend class methods + end + end + module LocalInstanceMethods + def flag + @obj=controller_name.classify.constantize.find(params[:id]) + text @obj.to_yaml + end + end + end +end +ActionController::Base.send :include, Flagable::ActsAsFlagable +ActionController.send :include, Flagable::ActsAsFlagable + +ApplicationController.send :include, Flagable::ActsAsFlagable +BeispielController.send :include, Flagable::ActsAsFlagable