Forum: Ruby on Rails Params and empty strings

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ead43bcb0202410540a6a7cee5955d46?d=identicon&s=25 Fresh Mix (giga)
on 2009-03-04 09:24
Is there some better way to do this?

http://assertbuggy.blogspot.com/2007/06/ruby-on-ra...
992f6dd317a9b164e1efc5b674623f38?d=identicon&s=25 Michael Graff (Guest)
on 2009-03-04 09:29
(Received via mailing list)
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 Mix
<rails-mailing-list@andreas-s.net> wrote:
>
> Is there some better way to do this?
>
> http://assertbuggy.blogspot.com/2007/06/ruby-on-ra...
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>



--
(Ruby, Rails, Random) blog:  http://skandragon.blogspot.com/
This topic is locked and can not be replied to.