Sha256: 4a85838797ed6346ccacc93886dd767161d4f0ace80d6a44f22f821eb4d3d26d

Contents?: true

Size: 566 Bytes

Versions: 7

Compression:

Stored size: 566 Bytes

Contents

# TODO3 Move all this app_specific stuff to sm_commons

# 
# HTML helpers
# 
[MongoMapper::EmbeddedDocument::InstanceMethods, MongoMapper::Document::InstanceMethods].each do |aclass|
  aclass.class_eval do
    def original_id; id end
  
    def dom_id
      new_record? ? "new_#{self.class.original_class.name.underscore}" : original_id.to_s
    end

    def to_param; original_id.to_s end
  end
end

[MongoMapper::EmbeddedDocument::ClassMethods, MongoMapper::Document::ClassMethods].each do |aclass|
  aclass.class_eval do
    def original_class; self end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rails-ext-0.3.2 lib/mongo_mapper_ext/view_helpers.rb
rails-ext-0.3.1 lib/mongo_mapper_ext/view_helpers.rb
rails-ext-0.3 lib/mongo_mapper_ext/view_helpers.rb
rails-ext-0.2.21 lib/mongo_mapper_ext/view_helpers.rb
rails-ext-0.2.20 lib/mongo_mapper_ext/view_helpers.rb
rails-ext-0.2.19 lib/mongo_mapper_ext/view_helpers.rb
rails-ext-0.2.18 lib/mongo_mapper_ext/view_helpers.rb