Module: Databasedotcom::Rails::Controller::ClassMethods
- Defined in:
- lib/databasedotcom/rails/controller.rb
Instance Method Summary collapse
- #const_missing(sym) ⇒ Object
- #dbdc_client ⇒ Object
- #dbdc_client=(client) ⇒ Object
- #sobject_types ⇒ Object
Instance Method Details
#const_missing(sym) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/databasedotcom/rails/controller.rb', line 30 def const_missing(sym) if sobject_types.include?(sym.to_s) dbdc_client.materialize(sym.to_s) else super end end |
#dbdc_client ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/databasedotcom/rails/controller.rb', line 5 def dbdc_client unless @dbdc_client config = YAML.load_file(File.join(::Rails.root, 'config', 'databasedotcom.yml')) config = config.has_key?(::Rails.env) ? config[::Rails.env] : config username = config["username"] password = config["password"] @dbdc_client = Databasedotcom::Client.new(config) @dbdc_client.authenticate(:username => username, :password => password) end @dbdc_client end |
#dbdc_client=(client) ⇒ Object
18 19 20 |
# File 'lib/databasedotcom/rails/controller.rb', line 18 def dbdc_client=(client) @dbdc_client = client end |
#sobject_types ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/databasedotcom/rails/controller.rb', line 22 def sobject_types unless @sobject_types @sobject_types = dbdc_client.list_sobjects end @sobject_types end |