Sha256: c02a0ccc6785ebf25591f9a0ff7f84d66e318677d2ab4234014a4dbb260127d9
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
module Trade class Admin::TradePromotesController < Admin::BaseController before_action :set_trade_promote, only: [:show, :edit, :update, :destroy] def index @trade_promotes = TradePromote.page(params[:page]) end def new @trade_promote = TradePromote.new end def create @trade_promote = TradePromote.new(trade_promote_params) unless @trade_promote.save render :new, locals: { model: @trade_promote }, status: :unprocessable_entity end end def show end def edit end def update @trade_promote.assign_attributes(trade_promote_params) unless @trade_promote.save render :edit, locals: { model: @trade_promote }, status: :unprocessable_entity end end def destroy @trade_promote.destroy end private def set_trade_promote @trade_promote = TradePromote.find(params[:id]) end def trade_promote_params p = params.fetch(:trade_promote, {}).permit( :amount, :note ) p.merge! edited: true end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_trade-0.0.3 | app/controllers/trade/admin/trade_promotes_controller.rb |