Class: Blogg::PostsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/blogg/posts_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_ability

Instance Method Details

#createObject

[View source]

21
22
23
24
25
# File 'app/controllers/blogg/posts_controller.rb', line 21

def create
  @post = Post.new(params[:post])
  @post.author = current_user
  create!(notice: 'Blog post was successfully created.')
end

#destroyObject

[View source]

13
14
15
# File 'app/controllers/blogg/posts_controller.rb', line 13

def destroy
  destroy!(notice: 'Blog post was successfully deleted.')
end

#updateObject

[View source]

17
18
19
# File 'app/controllers/blogg/posts_controller.rb', line 17

def update
  update!(notice: 'Blog post was successfully updated.')
end