Displaying 3 results from an estimated 3 matches for "condition_block".
2006 Jun 25
0
Using the database schema to help validate data
...# this is a hack for attributes which are reserved words
like ''type''
+ name = "#{column.name}_before_type_cast"
+ validates_length_of name, :maximum=>column.limit
+ end
+ end
+ }
+ end
+
def condition_block?(condition)
condition.respond_to?("call") && (condition.arity == 1 ||
condition.arity == -1)
end
--
Posted via http://www.ruby-forum.com/.
2006 Jul 05
2
Serialized object behaves weird
Hi!
I got a class named EinsatzFilter which I serialized to session. Before
saving to session it works afterwards I keep getting the message:
"undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from
ActiveRecord::Base inherited class.
Code:
class EinsatzFilter
include ApplicationHelper
attr_reader :personen, :monat, :projekte, :kunde
2005 Aug 10
5
validates_format_of on an optional field using :if
Hi there,
I''ve got the following in my model:
validates_format_of :postcode,
:with => /^([a-zA-Z]{1,2}[0-9]{1,2} [0-9]{1}[a-zA-Z]{2})$/,
:message => "is not valid",
:if => :postcode
... but it''s not working - it always insists on validation, even if postcode
is empty. Basically, the postcode field is optional, but if it''s filled in, I
want to