Sha256: 476aa2a9830c21a039681f5b6a4a764f718748923e49fbbe6439709cfed302ff
Contents?: true
Size: 823 Bytes
Versions: 8
Compression:
Stored size: 823 Bytes
Contents
class Admin::PromotionRulesController < Admin::BaseController resource_controller belongs_to :promotion create.response do |wants| wants.html { redirect_to edit_admin_promotion_path(parent_object) } wants.js { render :action => 'create', :layout => false} end destroy.response do |wants| wants.html { redirect_to edit_admin_promotion_path(parent_object) } wants.js { render :action => 'destroy', :layout => false} end private def build_object return @object if @object.present? if params[:promotion_rule] && params[:promotion_rule][:type] @object = params[:promotion_rule][:type].constantize.new(object_params) @object.promotion = parent_object else @object = end_of_association_chain.build(object_params) end @object end end
Version data entries
8 entries across 8 versions & 1 rubygems