Params and empty strings


#1

Is there some better way to do this?

http://assertbuggy.blogspot.com/2007/06/ruby-on-rails-params-and-empty-strings.html


#2

I usually use a before validate hook, and do things like:

def normalize_fields
self.foo = nil if self.foo.blank?
self.bar = nil if self.bar.blank?
end

On Wed, Mar 4, 2009 at 2:24 AM, Fresh M.
removed_email_address@domain.invalid wrote:

Is there some better way to do this?

http://assertbuggy.blogspot.com/2007/06/ruby-on-rails-params-and-empty-strings.html

Posted via http://www.ruby-forum.com/.


(Ruby, Rails, Random) blog: http://skandragon.blogspot.com/