forked from bofh/fetsite
AutoCommit Sam Jun 20 12:03:03 CEST 2015
This commit is contained in:
@@ -3,6 +3,7 @@ class BeispieleController < ApplicationController
|
||||
|
||||
load_and_authorize_resource
|
||||
include LikeVoteable
|
||||
acts_as_flagable
|
||||
def index
|
||||
@beispiele = Beispiel.all
|
||||
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
member do
|
||||
get 'like'
|
||||
get 'dislike'
|
||||
get 'flag'
|
||||
end
|
||||
end
|
||||
resources :lvas do
|
||||
|
||||
25
lib/flagable.rb
Normal file
25
lib/flagable.rb
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user