Class: LocalizedGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- LocalizedGenerator
- Defined in:
- lib/generators/localized/localized_generator.rb
Instance Method Summary collapse
Instance Method Details
#create_concerns_lib ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/generators/localized/localized_generator.rb', line 18 def create_concerns_lib create_file "app/concerns/localized/sites.rb", <<-SITES # this file was originally generated by the localized generator module Localized::Sites extend ActiveSupport::Concern included do # create bitfield for all supported sites include Bitfields # NOTE: order should not change, if it does site data may become corrupt. bitfield :sites, #{generate_flags} # default scope to filter by current locale to site map default_scope self.send(Localized::Config.locale_to_site_map[I18n.locale]) end end SITES end |
#create_localized_config ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/generators/localized/localized_generator.rb', line 6 def create_localized_config # create the create_file "config/localized.yml", <<-YAML_FILE # this file was originally generated by the localized generator default_host_prefix: 'www.' default_site: 'us' site_locale_map: #{generate_yaml_from_sites} YAML_FILE end |