generate local file on install rather than load

This commit is contained in:
Adam Meehan 2010-08-03 18:27:35 +10:00
parent 300bd96056
commit 048bf3ba6c
5 changed files with 5 additions and 4 deletions

View File

@ -38,7 +38,7 @@ Then run
rails generate validates_timeliness:install
This creates the template for the configuration initializer. You need to uncomment the extend_classes setting like so
This creates configuration initializer and locale files. In the initializer, you need to uncomment the extend_classes setting like so
ValidatesTimeliness.setup do |config|

View File

@ -9,6 +9,9 @@ module ValidatesTimeliness
copy_file 'validates_timeliness.rb', 'config/initializers/validates_timeliness.rb'
end
def copy_locale_file
copy_file 'en.yml', 'config/locales/validates_timeliness.en.yml'
end
end
end
end

View File

@ -42,5 +42,3 @@ require 'validates_timeliness/helper_methods'
require 'validates_timeliness/attribute_methods'
require 'validates_timeliness/extensions'
require 'validates_timeliness/version'
I18n.load_path << File.expand_path(File.dirname(__FILE__) + '/validates_timeliness/locale/en.yml')

View File

@ -21,7 +21,7 @@ end
Time.zone = 'Australia/Melbourne'
LOCALE_PATH = File.expand_path(File.dirname(__FILE__) + '/../lib/validates_timeliness/locale/en.yml')
LOCALE_PATH = File.expand_path(File.dirname(__FILE__) + '/../lib/generators/validates_timeliness/templates/en.yml')
I18n.load_path.unshift(LOCALE_PATH)
class Person