I think it's wrong argument type, it should be: include Geolocalizable
Concern and field Rails
-
14-10-2022 - |
题
i want to create a concern like this:
module Geolocalizable
extend ActiveSupport::Concern
include Mongoid
included do
attr_accessible :lat, :lng
field :lat
field :lng
end
end
And than include it in my model :
class Store
include Mongoid::Document
include 'Geolocalizable'
field :name, type: String
field :address, type: String
end
But in my stores/new.html.erb this line gives me an error
f.text_filed :lat
undefined method `lat' for #Store:0xae6bb58
How can i solve this?
解决方案
不隶属于 StackOverflow