Class: Dust::PostsController
Instance Method Summary
collapse
#not_authenticated, #permission_denied, #try_return_to_previous_page
Instance Method Details
#create ⇒ Object
20
21
22
23
24
25
26
27
28
|
# File 'app/controllers/dust/posts_controller.rb', line 20
def create
@post = Post.(params[:dust_post])
if @post.save
redirect_to front_end_post_path(@post.slug), notice: 'Post was successfully created.'
else
render action: "new"
end
end
|
#destroy ⇒ Object
40
41
42
43
44
45
|
# File 'app/controllers/dust/posts_controller.rb', line 40
def destroy
@post = Post.find(params[:id])
@post.destroy
redirect_to posts_url
end
|
#edit ⇒ Object
16
17
18
|
# File 'app/controllers/dust/posts_controller.rb', line 16
def edit
@post = Post.find(params[:id])
end
|
#index ⇒ Object
8
9
10
|
# File 'app/controllers/dust/posts_controller.rb', line 8
def index
@posts = Post.all
end
|
#new ⇒ Object
12
13
14
|
# File 'app/controllers/dust/posts_controller.rb', line 12
def new
@post = Post.
end
|
#update ⇒ Object
30
31
32
33
34
35
36
37
38
|
# File 'app/controllers/dust/posts_controller.rb', line 30
def update
@post = Post.find(params[:id])
if @post.update_attributes(params[:dust_post])
redirect_to front_end_post_path(@post.slug), notice: 'Post was successfully updated.'
else
render action: "edit"
end
end
|