Class: Admin::Posts::TitlesController
Instance Method Summary
collapse
#posts
#current_user, #signed_in?, #url
Instance Method Details
#create ⇒ Object
14
15
16
17
18
19
20
21
22
|
# 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 ⇒ Object
5
6
7
8
9
10
11
12
|
# 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 ⇒ Object
24
25
26
27
28
29
30
31
32
33
|
# 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
|