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
Article Edit.
-
#index ⇒ Object
Article Index.
-
#new ⇒ Object
Article New.
-
#show ⇒ Object
Article Show.
-
#update ⇒ Object
PATCH/PUT.
Methods inherited from Phcpresspro::ApplicationController
#current_user, #membership_info, #new_login_url, #require_user
Instance Method Details
#create ⇒ Object
POST
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/phcpresspro/articles/posts_controller.rb', line 31 def create @articles_post = Articles::Post.new(articles_post_params) @articles_post.user_id = current_user.id @articles_post.user_name = current_user.username @articles_post.membership_id = membership_info.id @articles_post.oganization_id = membership_info.org_id if @articles_post.save @articles_post.connections.build redirect_to articles_posts_url, notice: 'Post was successfully created.' else render :new end end |
#destroy ⇒ Object
DELETE
60 61 62 63 |
# File 'app/controllers/phcpresspro/articles/posts_controller.rb', line 60 def destroy @articles_post.destroy redirect_to articles_posts_url, notice: 'Post was successfully destroyed.' end |
#edit ⇒ Object
Article Edit
27 28 |
# File 'app/controllers/phcpresspro/articles/posts_controller.rb', line 27 def edit end |
#index ⇒ Object
Article Index
12 13 14 |
# File 'app/controllers/phcpresspro/articles/posts_controller.rb', line 12 def index @articles_posts = Articles::Post.all end |
#new ⇒ Object
Article New
21 22 23 24 |
# File 'app/controllers/phcpresspro/articles/posts_controller.rb', line 21 def new @articles_post = Articles::Post.new end |
#show ⇒ Object
Article Show
17 18 |
# File 'app/controllers/phcpresspro/articles/posts_controller.rb', line 17 def show end |
#update ⇒ Object
PATCH/PUT
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/controllers/phcpresspro/articles/posts_controller.rb', line 46 def update @articles_post.user_id = current_user.id @articles_post.user_name = current_user.username @articles_post.membership_id = membership_info.id @articles_post.oganization_id = membership_info.org_id if @articles_post.update(articles_post_params) @articles_post.connections.build redirect_to articles_posts_url, notice: 'Post was successfully updated.' else render :edit end end |