I'm trying to get the money-rails
gem working, and I'm having problems... >.<
Here's the product I have the appropriate columns on:
class ItemAttrVal < ActiveRecord::Base
belongs_to :attr_name
belongs_to :registry_item
monetize :price_val_cents, :allow_nil => true
#snip
end
I've run the migration, and the appropriate columns are there (price_val_cents
, and price_val_currency
).
I've got the gem in my Gemfile, and have run bundle install
successfully.
When I do ItemAttrVal.new
, I get this as the first line of the error message:
NoMethodError: undefined method `monetize' for #<Class:0x007fb489c759d0>
Could somebody help point out to me what simple thing I've missed?
I haven't included it anywhere as a require
(apart from my Gemfile), but I didn't think that was needed...
Thanks!
Based on Peter Brown's comment, you should restart the console whenever a new gem is added, or when environment variable is added or modified. Just exit and start it again, rebooting the server is also recommended.
Sometimes the problem persists, even after restart. In that case try to kill the spring server so you are starting completely fresh.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With