Class: Thredded::PostsController

Inherits:
ApplicationController show all
Includes:
ActionView::RecordIdentifier
Defined in:
app/controllers/thredded/posts_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#signed_in?

Instance Method Details

#create ⇒ Object



9
10
11
12
13
14
# File 'app/controllers/thredded/posts_controller.rb', line 9

def create
  post = parent_topic.posts.create!(post_params)

  reset_read_status if for_a_private_topic?
  redirect_to post_path(post)
end

#edit ⇒ Object



16
17
18
# File 'app/controllers/thredded/posts_controller.rb', line 16

def edit
  authorize! :edit, post
end

#topic ⇒ Object



26
27
28
# File 'app/controllers/thredded/posts_controller.rb', line 26

def topic
  post.postable
end

#update ⇒ Object



20
21
22
23
24
# File 'app/controllers/thredded/posts_controller.rb', line 20

def update
  post.update_attributes(post_params.except(:user, :ip))

  redirect_to post_path(post)
end