Sha256: e270156f52cc514fc7365070ea74eefd89b1249e42266080e7980a8dfa7e9ec8

Contents?: true

Size: 569 Bytes

Versions: 27

Compression:

Stored size: 569 Bytes

Contents

ImpressionistController::InstanceMethods.send(:define_method, :direct_create_statement) do |query_params={}|
	# creates a statment hash that contains default values for creating an impression.
	# if :impressionable_id is a valid ObjectId then convert it into one
	base = (defined? Moped) ? Moped::BSON : BSON
	query_params.reverse_merge!(
		:impressionable_type => controller_path.singularize.camelize,
		:impressionable_id=> !base::ObjectId.legal?(params[:id]) ? params[:id] : base::ObjectId.from_string(params[:id])
	)
	associative_create_statement(query_params)
end

Version data entries

27 entries across 27 versions & 3 rubygems

Version Path
impressionist-cody-2.0.0 lib/impressionist/controllers/mongoid/impressionist_controller.rb
impressionist-2.0.0 lib/impressionist/controllers/mongoid/impressionist_controller.rb
impressionist-1.6.1 lib/impressionist/controllers/mongoid/impressionist_controller.rb
impressionist-1.6.0 lib/impressionist/controllers/mongoid/impressionist_controller.rb
impressionist-1.5.2 lib/impressionist/controllers/mongoid/impressionist_controller.rb
impressionist2-1.5.5 lib/impressionist/controllers/mongoid/impressionist_controller.rb
impressionist2-1.5.4 lib/impressionist/controllers/mongoid/impressionist_controller.rb
impressionist2-1.5.3 lib/impressionist/controllers/mongoid/impressionist_controller.rb
impressionist2-1.5.1 lib/impressionist/controllers/mongoid/impressionist_controller.rb
impressionist-1.5.1 lib/impressionist/controllers/mongoid/impressionist_controller.rb
impressionist-1.4.13 lib/impressionist/controllers/mongoid/impressionist_controller.rb
impressionist-1.4.12 lib/impressionist/controllers/mongoid/impressionist_controller.rb
impressionist-1.4.11 lib/impressionist/controllers/mongoid/impressionist_controller.rb
impressionist-1.4.10 lib/impressionist/controllers/mongoid/impressionist_controller.rb
impressionist-1.4.9 lib/impressionist/controllers/mongoid/impressionist_controller.rb
impressionist-1.4.8 lib/impressionist/controllers/mongoid/impressionist_controller.rb
impressionist-1.4.7 lib/impressionist/controllers/mongoid/impressionist_controller.rb
impressionist-1.4.6 lib/impressionist/controllers/mongoid/impressionist_controller.rb
impressionist-1.4.5 lib/impressionist/controllers/mongoid/impressionist_controller.rb
impressionist-1.4.4 lib/impressionist/controllers/mongoid/impressionist_controller.rb