class Admin::Posts::TitlesController
Public Instance Methods
create()
click to toggle source
# File lib/ecrire/app/controllers/admin/posts/titles_controller.rb, line 14 def create @post = Admin::Post.find(params[:post_id]) @title = @post.titles.create(title_params) respond_to do |format| format.html { render 'index' } format.js end end
index()
click to toggle source
# File lib/ecrire/app/controllers/admin/posts/titles_controller.rb, line 5 def index @post = Admin::Post.find(params[:post_id]) if @post.published? || @post.titles.count > 1 @title = @post.titles.new else @title = @post.titles.first end end
update()
click to toggle source
# File lib/ecrire/app/controllers/admin/posts/titles_controller.rb, line 24 def update @post = Admin::Post.find(params[:post_id]) @title = Admin::Title.find(params[:id]) @title.update(title_params) respond_to do |format| format.html { render 'index' } format.js end end
Protected Instance Methods
title_params()
click to toggle source
# File lib/ecrire/app/controllers/admin/posts/titles_controller.rb, line 37 def title_params params.require(:title).permit(:name) end