Wednesday, 15 February 2012

Rails 3 ActiveModel: cannot include ActiveModel::Model directly -



Rails 3 ActiveModel: cannot include ActiveModel::Model directly -

in rails 3.2.11 , "development" environment when seek have active model:

class disponibilityapi include activemodel::model attr_accessor :start_time, :end_time validates :start_time, :end_time, :presence => true end

i have error:

nameerror: uninitialized constant activemodel::model

but when include manually:

class disponibilityapi extend activemodel::naming extend activemodel::translation include activemodel::validations include activemodel::conversion attr_accessor :start_time, :end_time validates :start_time, :end_time, :presence => true end

now works !

am missing ?

thanks !

activemodel::model new rails 4, why shows on github master, not in 3.x gems. if in 3.x version branches on github not there either.

https://github.com/rails/rails/tree/3-2-stable/activemodel/lib/active_model

for rails 3.x need include each of modules manually.

to see includes, check out file in master branch.

https://github.com/rails/rails/blob/master/activemodel/lib/active_model/model.rb

ruby-on-rails activemodel rails-activerecord

No comments:

Post a Comment