Sha256: 2937536877cde61d7c08ba964c178f2704b12996e9de6fccd7a6ab850b9e1c10
Contents?: true
Size: 1.1 KB
Versions: 6
Compression:
Stored size: 1.1 KB
Contents
module Impressionist # Impressionist::SetupAssociation.new(entity).set class SetupAssociation def initialize(receiver) @receiver = receiver end # True or False # Note toggle returns false if rails >= 4 def include_attr_acc? toggle && make_accessible end def define_belongs_to receiver.belongs_to(:impressionable, :polymorphic => true) end # returns done if thruthy def set :done if (include_attr_acc? && define_belongs_to) end private attr_reader :receiver, :toggle def make_accessible receiver. attr_accessible(:impressionable_type, :impressionable_id, :controller_name, :request_hash, :session_hash, :action_name, :ip_address, :view_name, :referrer, :message, :user_id) end def toggle t = RailsToggle.new t.should_include? end end end
Version data entries
6 entries across 6 versions & 1 rubygems