Class: Blogy::PostsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Blogy::PostsController
- Defined in:
- app/controllers/blogy/posts_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /posts.
-
#destroy ⇒ Object
DELETE /posts/1.
-
#edit ⇒ Object
GET /posts/1/edit.
-
#index ⇒ Object
GET /posts.
-
#new ⇒ Object
GET /posts/new.
-
#show ⇒ Object
GET /posts/1.
-
#update ⇒ Object
PATCH/PUT /posts/1.
Instance Method Details
#create ⇒ Object
POST /posts
30 31 32 33 |
# File 'app/controllers/blogy/posts_controller.rb', line 30 def create @post = Post.create(post_params) respond_with @post, root: :'blogy/post' end |
#destroy ⇒ Object
DELETE /posts/1
42 43 44 45 |
# File 'app/controllers/blogy/posts_controller.rb', line 42 def destroy @post.destroy respond_with @post, root: :'blogy/post' end |
#edit ⇒ Object
GET /posts/1/edit
25 26 27 |
# File 'app/controllers/blogy/posts_controller.rb', line 25 def edit respond_with @post, root: :'blogy/post' end |
#index ⇒ Object
GET /posts
8 9 10 11 |
# File 'app/controllers/blogy/posts_controller.rb', line 8 def index @posts = Post.joins(:translations).all respond_with @posts, root: :'blogy/posts' end |
#new ⇒ Object
GET /posts/new
19 20 21 22 |
# File 'app/controllers/blogy/posts_controller.rb', line 19 def new @post = Post.new respond_with @post, root: :'blogy/post' end |
#show ⇒ Object
GET /posts/1
14 15 16 |
# File 'app/controllers/blogy/posts_controller.rb', line 14 def show respond_with @post, root: :'blogy/post' end |
#update ⇒ Object
PATCH/PUT /posts/1
36 37 38 39 |
# File 'app/controllers/blogy/posts_controller.rb', line 36 def update @post.update(post_params) respond_with @post, root: :'blogy/post' end |