vestal_versions : problem with column named changes

1.2k Views Asked by At

I am working with vestal version for 2 months. Everything was fine until this afternoon. I didn't done anything special(or i don't remembered...) but the code works fine on others computers...

The problem is that i'm not able to save my model anymore: rails give me this error : ActiveRecord::DangerousAttributeError: changes is defined by ActiveRecord

changes field is by default an activerecord method.

With the console, the message is the next :

ActiveRecord::DangerousAttributeError: changes is defined by ActiveRecord

Here are my local gem files:

abstract (1.0.0)
actionmailer (3.0.0.beta3)
actionpack (3.0.0.beta3)
activemodel (3.0.0.beta3)
activerecord (3.0.0.beta3)
activeresource (3.0.0.beta3)
activesupport (3.0.0.beta3)
arel (0.3.3)
builder (2.1.2)
bundler (0.9.25, 0.9.24)
crack (0.1.7)
erubis (2.6.5)
god (0.9.0)
haml (3.0.1, 2.2.23)
i18n (0.3.7)
mail (2.2.0)
memcache-client (1.8.3)
memcached (0.17.7)
mime-types (1.16)
polyglot (0.3.1)
rack (1.1.0)
rack-mount (0.6.3)
rack-test (0.5.3)
rails (3.0.0.beta3)
railties (3.0.0.beta3)
rake (0.8.7)
savon (0.7.8, 0.7.6)
text-format (1.0.0)
text-hyphen (1.0.0)
thor (0.13.6, 0.13.4)
treetop (1.4.5)
tzinfo (0.3.20)

And here my Gemfile

source 'http://gemcutter.org'

gem "rails", "3.0.0.beta3"

gem "will_paginate", "3.0.pre"

#gem 'nokogiri'
#gem 'curb'
#gem 'handsoap'
gem 'savon'
gem 'mysql'
gem 'haml', '2.2.23'
#gem 'haml', '3.0.1'
gem 'hpricot'
gem 'i18n', '> 0.3.5'
gem 'i18n_routing'
gem 'i18n_auto_scoping'
gem 'handler301', :git => 'http://github.com/kwi/handler301.git'
gem 'seo_meta_builder'

gem 'vestal_versions'

#gem 'paperclip', :git => 'git://github.com/thoughtbot/paperclip.git', :branch => 'rails3'

## Bundle edge rails:
gem "rails", :git => "git://github.com/rails/rails.git"

## Bundle the gems you use:
# gem "bj"
# gem "hpricot", "0.6"
# gem "sqlite3-ruby", :require => "sqlite3"
# gem "aws-s3", :require => "aws/s3"

## Bundle gems used only in certain environments:
# gem "rspec", :group => :test
# group :test do
#   gem "webrat"
# end

If you have any suggestions to solve this issue, i'll be glad to hear them !

Thanks

1

There are 1 best solutions below

2
On

You have a field in your model called changes. This is a bad practice as the attribute accessor will mask the original changes method. Methods of ActiveRecord::Base should never be used as column names within the database.

If you have not changed anything then it is odd that you are seeing this now. Have you upgraded your ActiveRecord gem perhaps, or renamed a column from something to changes.

The simplest fix, if this is acceptable to you is to rename your changes column within your database.