Sha256: 0e73c6716fac3cde8d90b0bc624c65efdb62c24bd418e92368dcdd12b9ba9e5a
Contents?: true
Size: 667 Bytes
Versions: 23
Compression:
Stored size: 667 Bytes
Contents
module Admin class TitlesController < Admin::ApplicationController helper_method :post def index if post.draft? render 'edit' and return end end def create @title = Admin::Title.new(title_params) do |title| title.post = post end unless @title.save render 'errors' end end def update @title = Admin::Title.find(params[:id]) unless @title.update(title_params) render 'errors' end end protected def title_params params.require(:title).permit(:name) end def post @post ||= Post.find(params[:post_id]) end end end
Version data entries
23 entries across 23 versions & 1 rubygems