Skip to content

Commit

Permalink
Use class_eval over reopening the class.
Browse files Browse the repository at this point in the history
This way an exception is raised if the class doesn't exist, rather
than silently/potentially erroneously defining it as a new class.
  • Loading branch information
gabrielg committed Jan 22, 2015
1 parent 508c8ce commit fe4ec0d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/text_helpers/railtie.rb
Expand Up @@ -4,7 +4,7 @@ class Railtie < Rails::Railtie

initializer "text_helpers.configure_rails_initialization" do

class ActionView::Base
ActionView::Base.class_eval do
include TextHelpers::Translation

protected
Expand All @@ -28,7 +28,7 @@ def translation_scope
end
end

class ActionMailer::Base
ActionMailer::Base.class_eval do
include TextHelpers::Translation

protected
Expand All @@ -43,7 +43,7 @@ def translation_scope
end
end

class ActionController::Base
ActionController::Base.class_eval do
include TextHelpers::Translation

protected
Expand Down

0 comments on commit fe4ec0d

Please sign in to comment.