search for: effective_from

Displaying 3 results from an estimated 3 matches for "effective_from".

2010 Jan 21
2
nested forms and attr_accessable
Rails 2.3.5 I am working on a nested form that assigns roles to users through a table called clearances. I have attr_acessable turned off globally in an initializer: ActiveRecord::Base.send(:attr_accessible, nil) I have this set in clearance.rb attr_accessible(:description, :effective_from, :role_id, :superceded_after, :user_id) And this is what params looks like after the submit button is selected: {"user"=>{"id"=>"146"}, "commit"=>"Commit Changes", "_method"=>"put", "action"=&g...
2009 Jan 26
4
Mocking/Stubbing ActiveRecord.config.default_timezone
...rt of thing in a more general sense. At issue is the setting 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...
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