Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added exception_notification

  • Loading branch information...
commit 9c4e7f2cc7f1670484c2c9517ac2b443fbc7192a 1 parent 8388990
@orenomba authored
View
2  .gitignore
@@ -13,3 +13,5 @@
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
+
+public/assets
View
5 Gemfile
@@ -18,6 +18,11 @@ gem 'squeel'
gem 'formtastic-bootstrap', :git => "https://github.com/niedfelj/formtastic-bootstrap.git", :branch => 'bootstrap2-rails3-2-formtastic-2-2'
gem "i18n_generators"
+#http://stackoverflow.com/questions/3524127/exception-notification-gem-and-rails-3
+#https://github.com/smartinez87/exception_notification
+gem 'exception_notification', :require => 'exception_notifier'
+
+
# Gems used only for assets and not required
# in production environments by default.
group :assets do
View
3  Gemfile.lock
@@ -76,6 +76,8 @@ GEM
unf (~> 0.0.3)
erubis (2.7.0)
eventmachine (0.12.10)
+ exception_notification (2.6.1)
+ actionmailer (>= 3.0.4)
execjs (1.4.0)
multi_json (~> 1.0)
factory_girl (4.0.0)
@@ -251,6 +253,7 @@ DEPENDENCIES
annotate!
capybara!
coffee-rails (~> 3.2.1)
+ exception_notification
factory_girl_rails
formtastic-bootstrap!
growl
View
4 app/controllers/home_controller.rb
@@ -1,2 +1,6 @@
class HomeController < ApplicationController
+
+ def raise
+ 1/0
+ end
end
View
2  app/views/home/index.html.erb
@@ -2,6 +2,8 @@
<h1>welcome</h1>
</div>
+<h1><%= link_to "強制エラー(Production時にメールで通知)", raise_path %></h1>
+
<% if logged_in? %>
<h1><%= link_to "秘密のリンク", user_path(current_user) %></h1>
<% end %>
View
18 config/environments/production.rb
@@ -15,7 +15,7 @@
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
- config.assets.compile = false
+ config.assets.compile = true
# Generate digests for assets URLs
config.assets.digest = true
@@ -64,4 +64,20 @@
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
# config.active_record.auto_explain_threshold_in_seconds = 0.5
+
+ gmail = YAML.load(File.read File.join(Rails.root, ".gmail"))
+ config.action_mailer.delivery_method = :smtp
+ config.action_mailer.smtp_settings = {
+ :address => "smtp.gmail.com",
+ :port => 587,
+ :user_name => gmail["user_name"],
+ :password => gmail["password"],
+ :authentication => 'plain',
+ :enable_starttls_auto => true }
+
+ config.middleware.use ExceptionNotifier,
+ :email_prefix => "[exception] ",
+ :sender_address => %{"notifier" <#{gmail["sender"]}>},
+ :exception_recipients => Array(gmail["recipients"])
+
end
View
2  config/routes.rb
@@ -5,6 +5,8 @@
resources :users
resources :sessions
+ get "raise" => "home#raise", :as => "raise"
+
# The priority is based upon order of creation:
# first created -> highest priority.
Please sign in to comment.
Something went wrong with that request. Please try again.