Class: Fuel::Admin::AuthorsController
- Inherits:
-
AdminController
- Object
- ApplicationController
- FuelController
- AdminController
- Fuel::Admin::AuthorsController
- Defined in:
- app/controllers/fuel/admin/authors_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods inherited from FuelController
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/fuel/admin/authors_controller.rb', line 16 def create @params_hash = Rails.version[0].to_i < 4 ? params[:fuel_author] : set_start_date @author = Fuel::Author.new(@params_hash) if @author.save redirect_to fuel., notice: "Your author was successfully #{@message}." else render action: "new" end end |
#destroy ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'app/controllers/fuel/admin/authors_controller.rb', line 44 def destroy @author.posts.each do |post| post. = nil post.save end @author.destroy redirect_to fuel., notice: "Author was successfully deleted" end |
#edit ⇒ Object
28 29 30 |
# File 'app/controllers/fuel/admin/authors_controller.rb', line 28 def edit end |
#index ⇒ Object
9 10 |
# File 'app/controllers/fuel/admin/authors_controller.rb', line 9 def index end |
#new ⇒ Object
12 13 14 |
# File 'app/controllers/fuel/admin/authors_controller.rb', line 12 def new @author = Fuel::Author.new end |
#show ⇒ Object
53 54 55 56 57 58 59 |
# File 'app/controllers/fuel/admin/authors_controller.rb', line 53 def show @author = Fuel::Author.find(params[:id]) respond_to do |format| format.json { render json: @author } end end |
#update ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/fuel/admin/authors_controller.rb', line 32 def update @params_hash = Rails.version[0].to_i < 4 ? params[:fuel_author] : set_start_date @author.attributes = @params_hash if @author.save redirect_to fuel.(@author), notice: "Author was updated and #{@message}" else render action: "edit" end end |