svenfuchs/globalize3 — Issue #88: Custom setter causing issues
Author: kevinansfield
Created: 2011-12-18 14:46:48+00:00
State: open

Hi,

I have the following code in one of my models:

``` ruby
translates :company, :website, :description

validates :company, :website, :image, :presence => true
validate :validate_website

def website=(url)
return if url.blank?
self[:website] = url =~ /http:\/\// ? url : "http://#{url}"
end

private

def validate_website
return if website.blank?
errors.add(:website, 'is not a valid URL') unless website.match REGEXP
end
```

This is causing an issue as the website column is always set to nil when using globalize3. Do I have this set up incorrectly or is there a bug somewhere?

Thanks.