Class: Phcpresspro::Articles::PostsController
- Inherits:
-
Phcpresspro::ApplicationController
- Object
- ActionController::Base
- Phcpresspro::ApplicationController
- Phcpresspro::Articles::PostsController
- Defined in:
- app/controllers/phcpresspro/articles/posts_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST.
-
#destroy ⇒ Object
DELETE.
-
#edit ⇒ Object
Edit Article Post (/articles/posts/1/edit).
-
#index ⇒ Object
Article Post Index (/articles/posts).
-
#new ⇒ Object
Create a New Article Post (/articles/posts/new).
-
#show ⇒ Object
Single Article Post (/articles/posts/1).
-
#update ⇒ Object
PATCH/PUT.
Methods inherited from Phcpresspro::ApplicationController
#current_user, #new_login_url, #require_user
Instance Method Details
#create ⇒ Object
POST
28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/phcpresspro/articles/posts_controller.rb', line 28 def create @articles_post = Articles::Post.new(articles_post_params) if @articles_post.save @articles_post.connections.build redirect_to @articles_post, notice: 'Post was successfully created.' else render :new end end |
#destroy ⇒ Object
DELETE
50 51 52 53 |
# File 'app/controllers/phcpresspro/articles/posts_controller.rb', line 50 def destroy @articles_post.destroy redirect_to articles_posts_url, notice: 'Post was successfully destroyed.' end |
#edit ⇒ Object
Edit Article Post (/articles/posts/1/edit)
24 25 |
# File 'app/controllers/phcpresspro/articles/posts_controller.rb', line 24 def edit end |
#index ⇒ Object
Article Post Index (/articles/posts)
10 11 12 |
# File 'app/controllers/phcpresspro/articles/posts_controller.rb', line 10 def index @articles_posts = Articles::Post.all end |
#new ⇒ Object
Create a New Article Post (/articles/posts/new)
19 20 21 |
# File 'app/controllers/phcpresspro/articles/posts_controller.rb', line 19 def new @articles_post = Articles::Post.new end |
#show ⇒ Object
Single Article Post (/articles/posts/1)
15 16 |
# File 'app/controllers/phcpresspro/articles/posts_controller.rb', line 15 def show end |
#update ⇒ Object
PATCH/PUT
40 41 42 43 44 45 46 47 |
# File 'app/controllers/phcpresspro/articles/posts_controller.rb', line 40 def update if @articles_post.update(articles_post_params) @articles_post.connections.build redirect_to @articles_post, notice: 'Post was successfully updated.' else render :edit end end |