Sha256: 278a94689f4c7c60a40a3a1f7d1e8cd8665965fe61c48bf31d9cac87ec58df39
Contents?: true
Size: 1.34 KB
Versions: 2
Compression:
Stored size: 1.34 KB
Contents
module LesliGuard class AccountsController < ApplicationController before_action :set_account, only: %i[ show edit update destroy ] # GET /accounts def index @accounts = Account.all end # GET /accounts/1 def show end # GET /accounts/new def new @account = Account.new end # GET /accounts/1/edit def edit end # POST /accounts def create @account = Account.new(account_params) if @account.save redirect_to @account, notice: "Account was successfully created." else render :new, status: :unprocessable_entity end end # PATCH/PUT /accounts/1 def update if @account.update(account_params) redirect_to @account, notice: "Account was successfully updated.", status: :see_other else render :edit, status: :unprocessable_entity end end # DELETE /accounts/1 def destroy @account.destroy redirect_to accounts_url, notice: "Account was successfully destroyed.", status: :see_other end private # Use callbacks to share common setup or constraints between actions. def set_account @account = Account.find(params[:id]) end # Only allow a list of trusted parameters through. def account_params params.fetch(:account, {}) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lesli_guard-0.3.0 | app/controllers/lesli_guard/accounts_controller.rb |
lesli_guard-0.2.0 | app/controllers/lesli_guard/accounts_controller.rb |