search for: presence_of

Displaying 5 results from an estimated 5 matches for "presence_of".

2007 May 05
10
have_one and have_present
...#39;have_present'' doesn''t really tell me what is interesting about having it present, or why it should be present. I think ''require_attribute'' would be nice (''require'' would be even better, but obviously that is a keyword). Or ''validate_presence_of'': an { @asset.should validate_presence_of(:something) } That''s a little more Rails-developer-friendly than customer-friendly, but it still ''speaks'' better than ''have_present'' for me. FYI - Jay Fields has a Validatable framework that includes...
2005 Aug 19
2
data validation
...:contacts, :foreign_key =>''company_id'' has_and_belongs_to_many :categories, :join_table => ''company_to_category'', :foreign_key => ''company_id'', :association_foreign_key => ''category_id'' validates_presence_of :name validates_uniqueness_of :name validates_lenght_of :name, :maximum => "20" ,:message => "too long" end The presence_of and the uniqueness_of work fine, but it doesn''t throw any error when the name atribute is longer than 20.. Is there any p...
2008 Mar 02
0
Models are not initialised correctly with ''rake test'' in Merb 0.9.1
I''m using Sequel as my ORM and Test::Unit as my testing framework and have the following model: class Item < Sequel::Model validates do presence_of( :name, :uuid, :vendor_id, :vendor_reference, :amount, :currency_code ) uniqueness_of( :uuid ) end def initialize( *args ) super( *args ) self.uuid = UUID.random_create.to_s end end As you can see I overwrite initialize to set up the UUID when the model is instantiated. In my te...
2007 Jan 09
6
rcov seg fault
Hi Trying to get rcov going (has been working), but with the following context and specs it fails. context ''/account POST with invalid attendee'' do controller_name :account setup do Attendee.stub!(:create!).and_raise(ActiveRecord::RecordInvalid.new( Attendee.new)) end specify ''should raise on create'' do Attendee.should_receive(:create!).with({
2007 Oct 04
12
Rails' abilities fitting?
Hi, I''m looking at developing a reasonably complex web application, where most of the complexity actually lays in the database and the queries I need run on it. Some "classes" or models need to consist of an assembly of several tables. It would be trivial enough for me to code these queries in SQL, but as far as I understand Rails is trying to hide the database as