Skip to content

Instantly share code, notes, and snippets.

@AlexanderZaytsev
Last active December 10, 2015 08:18
Show Gist options
  • Save AlexanderZaytsev/4406333 to your computer and use it in GitHub Desktop.
Save AlexanderZaytsev/4406333 to your computer and use it in GitHub Desktop.
class MessagesController < ActionController::Base
def create
@message = Message.create! message_params
MessageTranslator.new(@message).translate! # Sends a request to Google Translate API
MessagePusher.new(@message).push! # Pushes to Pusher.com
end
def update
@message.update_attributes message_params
MessageTranslator.new(@message).translate!
MessagePusher.new(@message).push!
end
end
class Admin::MessagesController < ActionController::Base
def update
@message.update_attributes message_params
MessageTranslator.new(@message).translate!
MessagePusher.new(@message).push!
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment