Closed petebrowne closed 13 years ago
Thanks for the suggestion, but I would prefer to to avoid the extra dependency. Since I am already requiring Rails simply including the required ActiveModel module, and adding a couple methods to interact with the forms is not a big deal to me.
Understandable. Suggestion though: you should include ActiveModel::Conversion and define #persisted?
. Then your model will pass the ActiveModel::Lint::Tests.
Also, I don't think defining #read_attribute_for_validation
is necessary. By default it will use #send
and get the correct attributes defined by attr_accessor.
I will have to look into this more. Part of the model is based on an old blog post I read when Rails 3 was first being released with the great ActiveModel abstraction that allowed this. I'm not really aware of what the ActiveModel::Lint::Tests are to be honest so if you could explain how I can test against them or better yet submit a pull request that would pass them it would be greatly appreciated.
I used the method described here: http://library.edgecase.com/Rails/2010/10/30/activemodel-lint-test-for-rspec.html to use the ActiveModel::Lint::Tests in Rspec.
Thanks for the suggestion I wasn't aware of the Conversion module and Lint tests that will be handy for this gem.
As a shameless suggestion, you could use BasicModel as a base for the
ContactUs::Contact
model. It's meant to be used for tableless models: