Module: RailsDbLocalize

Defined in:
lib/rails_db_localize.rb,
lib/rails_db_localize/version.rb

Defined Under Namespace

Classes: Railtie, Translation, TranslationCache

Constant Summary collapse

VERSION =
"0.0.6"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.schemaObject (readonly)

This is the schematics of fields Useful for rake tasks after, to know:

- Which rows are not used anymore (because the field name has changed for example)
- Which models are not yet translated


9
10
11
# File 'lib/rails_db_localize.rb', line 9

def schema
  @schema
end

Class Method Details

.add_to_schema(model, field) ⇒ Object



11
12
13
14
15
# File 'lib/rails_db_localize.rb', line 11

def add_to_schema model, field
  @schema ||= {}
  arr = (@schema[model.to_s] ||= [])
  arr << field unless arr.index(field)
end

.gem_pathObject



26
27
28
# File 'lib/rails_db_localize.rb', line 26

def gem_path
  @gem_path ||= File.expand_path("..", File.dirname(__FILE__))
end

.load!Object



17
18
19
20
21
22
23
24
# File 'lib/rails_db_localize.rb', line 17

def load!
  %w(app/models).each do |dir|
    path = File.join(File.expand_path('../..', __FILE__), dir )
    $LOAD_PATH << path
    ActiveSupport::Dependencies.autoload_paths << path
    ActiveSupport::Dependencies.autoload_once_paths.delete(path)
  end
end