Files

Class Index [+]

Quicksearch

UbiquoCategories::Connectors::I18n

Public Class Methods

prepare_mocks() click to toggle source

(Not documented)

     # File vendor/plugins/ubiquo_categories/lib/ubiquo_categories/connectors/i18n.rb, line 299
299:       def self.prepare_mocks
300:         add_mock_helper_stubs({
301:           :show_translations => '', :ubiquo_category_set_categories_url => '',
302:           :ubiquo_category_set_category_path => '', :current_locale => '',
303:           :content_tag => '', :hidden_field_tag => '', :locale => Category,
304:           :new_ubiquo_category_set_category_path => ''
305:         })
306:       end
unload!() click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_categories/lib/ubiquo_categories/connectors/i18n.rb, line 35
35:       def self.unload!
36:         ::Category.instance_variable_set :@translatable, false
37:       end
validate_requirements() click to toggle source

Validates the ubiquo_i18n-related dependencies Returning false will halt the connector load

    # File vendor/plugins/ubiquo_categories/lib/ubiquo_categories/connectors/i18n.rb, line 7
 7:       def self.validate_requirements
 8:         unless Ubiquo::Plugin.registered[:ubiquo_i18n]
 9:           unless Rails.env.test?
10:             raise ConnectorRequirementError, "You need the ubiquo_i18n plugin to load #{self}"
11:           else
12:             return false
13:           end
14:         end
15:         if ::Category.table_exists?
16:           category_columns = ::Category.columns.map(&:name).map(&:to_sym)
17:           unless [:locale, :content_id].all?{|field| category_columns.include? field}
18:             if Rails.env.test?
19:               ::ActiveRecord::Base.connection.change_table(:categories, :translatable => true){}
20:               if ::ActiveRecord::Base.connection.class.included_modules.include?(Ubiquo::Adapters::Mysql)
21:                 # "Supporting" DDL transactions for mysql
22:                 ::ActiveRecord::Base.connection.begin_db_transaction
23:                 ::ActiveRecord::Base.connection.create_savepoint
24:               end
25:               ::Category.reset_column_information
26:             else
27:               raise ConnectorRequirementError,
28:               "The categories 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

Disabled; run with $DEBUG to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.