Moved to generic event execution.

This commit is contained in:
Martin Edenhofer 2012-04-16 16:35:10 +02:00
parent 6d79f6caa0
commit 1035723797
3 changed files with 6 additions and 20 deletions

View file

@ -3,10 +3,8 @@ class ApplicationController < ActionController::Base
# http_basic_authenticate_with :name => "test", :password => "ttt"
helper_method :current_user, :authentication_check, :config_frontend, :user_data_full
before_filter :set_user, :cors_preflight_check
after_filter :set_access_control_headers
after_filter :set_access_control_headers, :trigger_events
# For all responses in this controller, return the CORS access control headers.
def set_access_control_headers
@ -38,6 +36,11 @@ class ApplicationController < ActionController::Base
private
# execute events
def trigger_events
Ticket::Observer::Notification.transaction
end
# Finds the User with the ID stored in the session with the key
# :current_user_id This is a common way to handle user login in
# a Rails application; logging in sets the session value and

View file

@ -34,9 +34,6 @@ class TicketArticlesController < ApplicationController
:o_id => @article.ticket_id
)
# execute ticket events
Ticket::Observer::Notification.transaction
render :json => @article, :status => :created
else
render :json => @article.errors, :status => :unprocessable_entity
@ -48,10 +45,6 @@ class TicketArticlesController < ApplicationController
@article = Ticket::Article.find(params[:id])
if @article.update_attributes(params[:ticket_article])
# execute ticket events
Ticket::Observer::Notification.transaction
render :json => @article, :status => :ok
else
render :json => @article.errors, :status => :unprocessable_entity

View file

@ -55,9 +55,6 @@ class TicketsController < ApplicationController
)
end
# execute ticket events
Ticket::Observer::Notification.transaction
render :json => @ticket, :status => :created
end
@ -66,10 +63,6 @@ class TicketsController < ApplicationController
@ticket = Ticket.find(params[:id])
if @ticket.update_attributes(params[:ticket])
# execute ticket events
Ticket::Observer::Notification.transaction
render :json => @ticket, :status => :ok
else
render :json => @ticket.errors, :status => :unprocessable_entity
@ -81,9 +74,6 @@ class TicketsController < ApplicationController
@ticket = Ticket.find(params[:id])
@ticket.destroy
# execute ticket events
Ticket::Observer::Notification.transaction
head :ok
end
end