0

How can I set an attribute in a rails concern?

here is my concern:

module Nodeable
  extend ActiveSupport::Concern
  def set_lat                
    lat = 5
  end
end

And then if i try to use it

test = Item.first
test.set_lat
test.save!

Check if it worked:

test.lat
=> nil
Will
  • 4,072
  • 2
  • 34
  • 59

0 Answers0