Class: Phcpresspro::Articles::PostsController

Inherits:
Phcpresspro::ApplicationController show all
Defined in:
app/controllers/phcpresspro/articles/posts_controller.rb

Instance Method Summary collapse

Methods inherited from Phcpresspro::ApplicationController

#current_user, #new_login_url, #require_user

Instance Method Details

#createObject

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

#destroyObject

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

#editObject

Edit Article Post (/articles/posts/1/edit)



24
25
# File 'app/controllers/phcpresspro/articles/posts_controller.rb', line 24

def edit
end

#indexObject

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

#newObject

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

#showObject

Single Article Post (/articles/posts/1)



15
16
# File 'app/controllers/phcpresspro/articles/posts_controller.rb', line 15

def show
end

#updateObject

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