Sha256: f0e70b0606ee627c3ce0d9ed5c16ad09ce37986fc9d885b7e5c0bb5755ce9301
Contents?: true
Size: 756 Bytes
Versions: 1
Compression:
Stored size: 756 Bytes
Contents
module Transit class Context include Mongoid::Document field :name, :type => String field :meta, :type => Hash, :default => {} field :body, :type => String field :position, :type => Integer before_save :ensure_context_position_value embedded_in :package, polymorphic: true def ensure_context_position_value return true unless self.position.nil? self.position = _parent.send(:contexts).count + 1 end # Sets up an "identifier" for the particular context def shortname self.class.to_s.underscore end # Sets up a default name field to be used in form helpers def field_name (self.name.to_s.blank? ? self.class.to_s : self.name) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
transit-0.0.1 | lib/transit/context.rb |