search for: old_model

Displaying 2 results from an estimated 2 matches for "old_model".

Did you mean: old_mode
2007 Apr 04
4
joining across databases in a find statement with include (legacy db)
...9;old'' and a new database ''new'' which rails uses. I set up models using old with establish_connection(old), and this works well, except for include: class OldModel < ActiveRecord::Base establish_connection(old) end class NewModel < ActiveRecord::Base has_one :old_model end a = OldModel.find :first NewModel.find(:all, :include => :old_model) will give an error like Mysql::Error: Table ''new_db.old_models'' doesn''t exist: SELECT ... FROM new_models LEFT OUTER JOIN old_models ON ... WHERE ... Obviously a performance hit without the j...
2007 Dec 15
2
Reading Model data before update
Hi all, here is the challenge: I have this validation method, that basically prevents an object which billed = true to be updated: def before_update if read_attribute(:billed) errors.add_to_base(''This service has already been billed for'') end !read_attribute(:billed) end The above code does not work in case I do something like: object =