Sha256: 261894f1aadbc2b169d2f882500dfccbd32cc18533eee05715051ea66411d87f
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
module Trade class Admin::CardPromotesController < Admin::BaseController before_action :set_card_template before_action :set_card_promote, only: [:show, :edit, :update, :destroy] before_action :prepare_form, only: [:new, :edit] def index @card_promotes = @card_template.card_promotes.page(params[:page]) end def new @card_promote = @card_template.card_promotes.build end def create @card_promote = @card_template.card_promotes.build(card_promote_params) unless @card_promote.save render :new, locals: { model: @card_promote }, status: :unprocessable_entity end end def show end def edit end def update @card_promote.assign_attributes(card_promote_params) unless @card_promote.save render :edit, locals: { model: @card_promote }, status: :unprocessable_entity end end def destroy @card_promote.destroy end private def set_card_template @card_template = CardTemplate.find params[:card_template_id] end def set_card_promote @card_promote = CardPromote.find(params[:id]) end def prepare_form @promotes = Promote.default_where(default_params) end def card_promote_params params.fetch(:card_promote, {}).permit( :income_min, :income_max, :promote_id ) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_trade-0.0.3 | app/controllers/trade/admin/card_promotes_controller.rb |