Tag Archives: Validation

Estimating programming time for implementing Rails validation callbacks

Estimating the cost of software is really hard. Hard enough that most Rails shops only bill by the hour on Time & Materials instead of by the project with a fixed bid. That said, it’s still helpful to have an idea how long something does take to implement, given a range of experience and and […]

Posted in estimation | Also tagged , , , | Leave a comment

Testing DateTime ActiveRecord validation callback

#!/usr/bin/env ruby require ‘active_record’ require ‘rspec’ DB_SPEC = { :adapter => “sqlite3″, :database => “artest.db”, :pool => 5, :timeout => 5000 } ActiveRecord::Base.establish_connection(DB_SPEC) class Users < ActiveRecord::Migration def self.up create_table :users do |t| t.string :name t.datetime :startdate t.datetime :finishdate end end def self.down drop_table :users end end unless Users.table_exists?(:users) ActiveRecord::Migrator.migrate(Users.up) end class User < ActiveRecord::Base […]

Posted in rails | Also tagged , , | 1 Response

Code Kata Fat Model Validating Presence

[Revised July 31, 2011] Code kata is a powerful weapon in your programming arsenal; probably the most powerful weapon in mine. The deliberate practice of programming using the code kata technique acknowledges the truth: “Simple things are hard enough.” In Rails programming, using the Fat Model Skinny Controller paradigm, models occupy a lot of attention […]

Posted in rails | Also tagged , , , | Leave a comment


dool.in