search for: superseded_after

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

2009 Jan 26
4
Mocking/Stubbing ActiveRecord.config.default_timezone
...of config values in environment.rb files and their influence on user code. In the specific case I encountered this code demonstrates the essence of the situation: def active_row? time_now = DateTime.now return true if (effective_from <= time_now and (not superseded_after or superseded_after >= time_now )) return false end The error is that the time_now assignment is not testing whether or not the default AR time is utc. The correct code is: def active_row? if self.class.default_timezone == :utc time_now = DateTime.now.utc els...
2008 Mar 08
9
Validation error handling on related models
I have 2 models, entity and client. Entity has_one client and client belongs_to entity. Entity has attributes name and legal_name. Entity also has an unique index on (lower(name)). The pKey for both is the conventional Rails id. Client has a fKey constraint on entity_id and is indexed in entity_id. In controllers/clients_controller.rb I have: # GET /clients/new # GET /clients/new.xml