Skip to content

Instantly share code, notes, and snippets.

@mamhoff
Created December 2, 2013 17:08

Revisions

  1. mamhoff created this gist Dec 2, 2013.
    26 changes: 26 additions & 0 deletions admins_controller.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    class AdminsController < ApplicationController
    def new
    @admin = Admin.new
    end

    def show
    @admin = Admin.find(params[:id])
    end

    def create
    @admin = Admin.new(admin_params)
    if @admin.save
    flash[:success] = "Welcome to the Solar Explorer!"
    redirect_to @admin
    else
    render 'new'
    end
    end

    private
    def admin_params
    params.require(:admin).permit(:name, :email, :password,
    :password_confirmation)
    end

    end
    26 changes: 26 additions & 0 deletions guides_controller.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    class GuidesController < ApplicationController
    def new
    @guide = Guide.new
    end

    def show
    @guide = Guide.find(params[:id])
    end

    def create
    @guide = Guide.new(guide_params)
    if @guide.save
    flash[:success] = "Welcome to the Solar Explorer!"
    redirect_to @guide
    else
    render 'new'
    end
    end

    private
    def guide_params
    params.require(:guide).permit(:name, :email, :password,
    :password_confirmation)
    end

    end