Class: Inboxes::DiscussionsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- Inboxes::DiscussionsController
- Defined in:
- app/controllers/inboxes/discussions_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/inboxes/discussions_controller.rb', line 28 def create @discussion.add_recipient_token current_user.id @discussion..each do |m| m.discussion = @discussion m.user = current_user end if @discussion.save redirect_to @discussion, :notice => t("inboxes.discussions.started") else render :action => "new" end end |
#destroy ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/inboxes/discussions_controller.rb', line 17 def destroy @discussion.destroy flash[:notice] = t("inboxes.discussions.removed") begin redirect_to :back rescue ActionController::RedirectBackError redirect_to discussions_url end end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/inboxes/discussions_controller.rb', line 5 def index @discussions = current_user.discussions end |
#new ⇒ Object
13 14 15 |
# File 'app/controllers/inboxes/discussions_controller.rb', line 13 def new @discussion..build end |
#show ⇒ Object
9 10 11 |
# File 'app/controllers/inboxes/discussions_controller.rb', line 9 def show @discussion.mark_as_read_for(current_user) end |