[Rails] Re: How to communicate with salesforce

2011-01-20 Thread Sem Ptiri
Kunjan Batavia wrote in post #976176: > Hi, > > I would like to know that how to communicate using ROR with salesforce. I would suggest you start by reading through http://www.salesforce.com/us/developer/docs/api/index.htm > For that I have setup ROR on my local system and while executing > comm

[Rails] Re: Dynamic class creation at runtime

2011-01-19 Thread Sem Ptiri
Everything's perfect now. Thanks again for the repeated replies. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubs

[Rails] Re: Dynamic class creation at runtime

2011-01-19 Thread Sem Ptiri
Frederick Cheung wrote in post #975987: > Probably the result of you suppressing the columns method. If AR > things there are no columns, it will think there are no attributes >From the superclass. Right. Thanks. -- Posted via http://www.ruby-forum.com/. -- You received this message because yo

[Rails] Re: Re: Dynamic class creation at runtime

2011-01-19 Thread Sem Ptiri
Frederick Cheung wrote in post #975964: > It is, but you're using it back to front: klass.const_set sets a > constant on klass, whereas you want to set a top level constant ie > Object.const_set You are my personal hero, today. Thank you so much for helping out on this thread. It works. -- Post

[Rails] Re: Dynamic class creation at runtime

2011-01-19 Thread Sem Ptiri
Ok, so this seems to work 1) Create dynamic classes from a list (some rework on getting that from tables automatically needed) 2) Instantiate those objects A minor error pops up now. The tables exist, as do the fields. However, with: service = Services.new(:portID => 333, :method => "PUT") B

[Rails] Re: Re: Dynamic class creation at runtime

2011-01-19 Thread Sem Ptiri
Frederick Cheung wrote in post #975964: > It is, but you're using it back to front: klass.const_set sets a > constant on klass, whereas you want to set a top level constant ie > Object.const_set That makes sense, thought it might be a scope problem. Thank you. -- Posted via http://www.ruby-foru

[Rails] Re: Dynamic class creation at runtime

2011-01-19 Thread Sem Ptiri
Frederick Cheung wrote in post #975672: > That's just what you're printing out - the return value of > set_table_name isn't documented, so i wouldn't assume nil or false to > mean failure OK, so I'm down to: class ExternalApp < ActiveRecord::Base self.abstract_class = true establish_connecti

[Rails] Re: Dynamic class creation at runtime

2011-01-17 Thread Sem Ptiri
Thanks for your repeated answers. Frederick Cheung wrote in post #975619: > what happens when you try? Class set table name failed -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to th

[Rails] Re: Dynamic class creation at runtime

2011-01-17 Thread Sem Ptiri
# APP_TABLES contain a list of table names - would be better to dynamically read them after connecting APP_TABLES.each do |table_name| class_name = table_name.camelize klass = Class.new(App) constant_name = "#{class_name}" # even though klass is created with App as superclass (inheriting

[Rails] Re: Dynamic class creation at runtime

2011-01-17 Thread Sem Ptiri
Frederick Cheung wrote in post #975445: > On Jan 17, 12:44pm, Sem Ptiri wrote: >> class App < ActiveRecord::Base >> abstract_class = true >> > this should be self.abstract_class = true (right now you're just > setting a local variable) Point taken. >>

[Rails] Re: Dynamic class creation at runtime

2011-01-17 Thread Sem Ptiri
Thanks for the reply. Frederick Cheung wrote in post #975422: >> klass = class_eval do >>#unsure about this. I need to set table_name to same as class name >>ActiveRecord::Base.set_table_name("#{class_name}") >>ActiveRecord::Base.const_set(constant_name, klass) >> end # class_eval > >

[Rails] Dynamic class creation at runtime

2011-01-17 Thread Sem Ptiri
I have a scenario where I need to dynamically create classes from existing application (external to app) databases, to pull data for reports. # Table definitions APP_TABLES = %w(#list of tables for a given app - I'm sure I could query this on a simple connect. But let's stick to this for now.)

[Rails] Re: Handling migrations with multiple databases in Rails

2011-01-17 Thread Sem Ptiri
Thanks. It does seem like multiple DBs and migrations do not necessarily play well. Would be interesting to see a recipe for this somewhere. Frederick Cheung wrote in post #972014: > You might find it easier to define a rails env for each of these > databases and then run migrate for each such e

[Rails] Handling migrations with multiple databases in Rails

2011-01-03 Thread Sem Ptiri
I have a Rails reporting application that will generate reports for other Rails applications. As such I need to import legacy databases, but might also over time, change them. How do I handle migrations with having, and connecting to, x number of databases? I've defined the 'other' databases con

[Rails] Re: AssociationTypeMismatch

2010-10-26 Thread Sem Ptiri
class Pair < ActiveRecord::Base belongs_to :flag belongs_to :item, :class_name => 'Item', :foreign_key => 'item_1', :validate => true belongs_to :item, :class_name => 'Item', :foreign_key => 'item_2', :validate => true end seems to fix the problem. -- Posted via http://www.ruby-forum.c

[Rails] AssociationTypeMismatch

2010-10-26 Thread Sem Ptiri
I have a very simple pairing scenario that links a pair to two items (cross-comparison and rating). My problem is that on insertion of the pair I get an AssociationTypeMismatch error, that I haven't seen before. class Pair < ActiveRecord::Base has_one :flag has_one :item_1, :class_name => 'It

[Rails] Re: Railroad problem with :through?

2010-09-30 Thread Sem Ptiri
Ar Chron wrote: > Sem Ptiri wrote: > > Is this a typo, or your problem source? > >> class Subscriber < ActiveRecord::Base >> has_many :lists >> has_many :lists, :through => :list_subscribers >> end >> > > class Subscriber < ActiveRecord

[Rails] Railroad problem with :through?

2010-09-29 Thread Sem Ptiri
I have the following model layout: class List < ActiveRecord::Base has_many :subscribers, :through => :list_subscribers has_many :list_subscribers end class Subscriber < ActiveRecord::Base has_many :lists has_many :lists, :through => :list_subscribers end class ListSubscriber< ActiveRecord::Base