Sha256: 63f6ce1b7d06edd5bdb20ae11c2686d5b6a1dbe34b2be38d61dc617c9de9ee8f
Contents?: true
Size: 1.46 KB
Versions: 16
Compression:
Stored size: 1.46 KB
Contents
# Provides CRUD actions for +Author+ model. require_dependency "lines/admin/application_controller" module Lines module Admin class AuthorsController < ApplicationController # Listes all authroes def index @authors = Author.all end # Shows an author def show @author = Author.find(params[:id]) end # New author def new @author = Lines::Author.new end # Edit an existing author def edit @author = Author.find(params[:id]) end # Create a new author from params def create @author = Author.new(author_params) if @author.save redirect_to admin_author_path @author else render action: "new" end end # Update an existing author from params def update @author = Author.find(params[:id]) if @author.update_attributes(author_params) redirect_to admin_author_path(@author) else render action: "edit" end end # Delete an author def destroy @author = Author.find(params[:id]) if @author.destroy redirect_to admin_authors_url else @authors = Author.all render "index" end end private # Use strong_params def author_params params.require(:author).permit(:email, :name, :description, :gplus_profile) end end end end
Version data entries
16 entries across 16 versions & 1 rubygems