Sha256: 155276c95d0ae1725dc62c22b6453eb2d9c8f953eb8bb5cc3cf7a7bc700bba1d

Contents?: true

Size: 617 Bytes

Versions: 1

Compression:

Stored size: 617 Bytes

Contents

class RailsTradeMy::BuyersController < RailsTradeMy::BaseController
  before_action :set_buyer, only: [:show, :edit, :update]

  def show
    respond_to do |format|
      format.js
      format.html
      format.json { render json: @user }
    end
  end

  def edit
  end

  def update
    @buyer.assign_attributes(buyer_params)
    @buyer.save

    if @buyer.saved_changes?
      redirect_to my_buyer_path, notice: 'Buyer 更新成功!'
    else
      render action: 'edit'
    end
  end

  private
  def set_buyer
    @buyer = current_buyer
  end

  def buyer_params
    params.fetch(:buyer, {}).permit!
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_trade-0.0.1 app/controllers/the_trade_my/buyers_controller.rb