Files

Class Index [+]

Quicksearch

UbiquoDesign::Connectors::I18n

Public Class Methods

load!() click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_design/lib/ubiquo_design/connectors/i18n.rb, line 5
 5:       def self.load!
 6:         super
 7:         ::Widget.send(:include, self::Widget)
 8:         # TODO include i18n goodies in ::PublicController, not ::PagesController
 9:         #::PagesController.send(:include, UbiquoI18n::Extensions::LocaleChanger)
10:         #::PagesController.send(:helper, UbiquoI18n::Extensions::Helpers)
11:       end
unload!() click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_design/lib/ubiquo_design/connectors/i18n.rb, line 36
36:       def self.unload!
37:         # TODO create generic methods for these cleanups
38:         [::Widget].each do |klass|
39:           klass.instance_variable_set :@translatable, false
40:         end
41:         ::Widget.send :alias_method, :block, :block_without_shared_translations
42:         # Unfortunately there's no neat way to clear the helpers mess
43:         %w{Widgets}.each do |controller_name|
44:           ::Ubiquo.send(:remove_const, "#{controller_name}Controller")
45:           load "ubiquo/#{controller_name.tableize}_controller.rb"
46:         end
47:       end
validate_requirements() click to toggle source

Validates the ubiquo_i18n-related dependencies

    # File vendor/plugins/ubiquo_design/lib/ubiquo_design/connectors/i18n.rb, line 14
14:       def self.validate_requirements
15:         unless Ubiquo::Plugin.registered[:ubiquo_i18n]
16:           raise ConnectorRequirementError, "You need the ubiquo_i18n plugin to load #{self}"
17:         end
18:         [::Widget].each do |klass|
19:           if klass.table_exists?
20:             klass.reset_column_information
21:             columns = klass.columns.map(&:name).map(&:to_sym)
22:             unless [:locale, :content_id].all?{|field| columns.include? field}
23:               if Rails.env.test?
24:                 ::ActiveRecord::Base.connection.change_table(klass.table_name, :translatable => true){}
25:                 klass.reset_column_information
26:               else
27:                 raise ConnectorRequirementError,
28:                   "The #{klass.table_name} table does not have the i18n fields. " +
29:                   "To use this connector, update the table enabling :translatable => true"
30:               end
31:             end
32:           end
33:         end
34:       end

Disabled; run with $DEBUG to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.