Sha256: 2e68a38d2bf87330d6c1b2f060c678e31d582c117838ab8b496e49da946fc36b

Contents?: true

Size: 1.03 KB

Versions: 34

Compression:

Stored size: 1.03 KB

Contents

## intended to be mixed into the product_class
## contains methods assuming that an item is going to be processed by using the modules provided by the work concern.
module Auth::Concerns::Work::GoodConcern

	extend ActiveSupport::Concern
	
	included do 	
		embeds_many :parameters, :class_name => "Auth::Work::Parameter"
		embeds_many :actors, :class_name => "Auth::Work::Actor"
		embeds_many :variables, :class_name => "Auth::Work::Variable"	

		after_initialize do |document|
			document.summary = document.build_summary
		end

		attr_accessor :summary
		
	end

	def build_summary
		self.summary = []
		self.instructions.each do |inst|
			self.summary << {
				:summary_icon_class => inst.summary_icon_class,
				:summary_text => inst.summary_text,
				:summary_icon_color => inst.summary_icon_color
			} if inst.include_in_summary == true
		end
	end

	def as_json(options)
	  ## includes the images associated with the object as well.
	  super({:methods => [:embedded_document_path, :embedded_document, :summary, :images]}.merge(options))
	end

end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
wordjelly-auth-1.6.0 app/models/auth/concerns/work/good_concern.rb
wordjelly-auth-1.5.9 app/models/auth/concerns/work/good_concern.rb
wordjelly-auth-1.5.8 app/models/auth/concerns/work/good_concern.rb
wordjelly-auth-1.5.7 app/models/auth/concerns/work/good_concern.rb
wordjelly-auth-1.5.6 app/models/auth/concerns/work/good_concern.rb
wordjelly-auth-1.5.5 app/models/auth/concerns/work/good_concern.rb
wordjelly-auth-1.5.4 app/models/auth/concerns/work/good_concern.rb
wordjelly-auth-1.5.3 app/models/auth/concerns/work/good_concern.rb
wordjelly-auth-1.5.2 app/models/auth/concerns/work/good_concern.rb
wordjelly-auth-1.5.1 app/models/auth/concerns/work/good_concern.rb
wordjelly-auth-1.5.0 app/models/auth/concerns/work/good_concern.rb
wordjelly-auth-1.4.9 app/models/auth/concerns/work/good_concern.rb
wordjelly-auth-1.4.8 app/models/auth/concerns/work/good_concern.rb
wordjelly-auth-1.4.7 app/models/auth/concerns/work/good_concern.rb
wordjelly-auth-1.4.6 app/models/auth/concerns/work/good_concern.rb
wordjelly-auth-1.4.5 app/models/auth/concerns/work/good_concern.rb
wordjelly-auth-1.4.4 app/models/auth/concerns/work/good_concern.rb
wordjelly-auth-1.4.3 app/models/auth/concerns/work/good_concern.rb
wordjelly-auth-1.4.2 app/models/auth/concerns/work/good_concern.rb
wordjelly-auth-1.4.0 app/models/auth/concerns/work/good_concern.rb