Question

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?

Was it helpful?

Solution

I think it's wrong argument type, it should be: include Geolocalizable

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top