Search code examples
ruby-on-rails-3.1

Tableless model in rails 3.1


Looks like this method doesn't work anymore in rails 3.1. So, does someone have a working solution?

Actually, I've found this gist. It solves problems with columns_hash and column_defaults errors from the railscast's solution but I get ActiveRecord::ConnectionNotEstablished error all the time when I try to write some attribute.

Any thoughts?


Solution

  • You should create your own model class and mix in the parts of ActiveModel (for example, validations) that you require. This blog post from Yehuda Katz has the details.