Class: Admin::LinksController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::LinksController
- Defined in:
- app/controllers/stenographer/admin/links_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/stenographer/admin/links_controller.rb', line 13 def create @link = Link.new(link_params) if @link.save redirect_to admin_link_path(@link), notice: 'Link Created' else flash.now[:alert] = @link.errors..to_sentence render :new end end |
#destroy ⇒ Object
46 47 48 49 50 51 52 |
# File 'app/controllers/stenographer/admin/links_controller.rb', line 46 def destroy if @link.destroy redirect_to admin_links_path, notice: 'Link Destroyed' else redirect_to admin_link_path(@link), alert: @link.errors..to_sentence end end |
#edit ⇒ Object
31 |
# File 'app/controllers/stenographer/admin/links_controller.rb', line 31 def edit; end |
#index ⇒ Object
24 25 26 27 |
# File 'app/controllers/stenographer/admin/links_controller.rb', line 24 def index page = params[:page] || 1 @links = Link.order(created_at: :desc).paginate(page: page, per_page: Stenographer.per_page) end |
#new ⇒ Object
9 10 11 |
# File 'app/controllers/stenographer/admin/links_controller.rb', line 9 def new @link = Link.new end |
#show ⇒ Object
29 |
# File 'app/controllers/stenographer/admin/links_controller.rb', line 29 def show; end |
#update ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/stenographer/admin/links_controller.rb', line 33 def update = {} if @link.update(link_params) [:notice] = 'Link Updated' redirect_to admin_link_path(@link), else flash.now[:alert] = @link.errors..to_sentence render :edit end end |