Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

10 lines (10 sloc) 0.568 kB
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_name.singularize.camelize,
:impressionable_id=> !base::ObjectId.legal?(params[:id]) ? params[:id] : base::ObjectId.from_string(params[:id])
)
associative_create_statement(query_params)
end
Jump to Line
Something went wrong with that request. Please try again.