Ok, I know I''m missing something obvious here, but I can''t spot it. I installed the money gem. I''ve got this in my model: composed_of :unit_price_object, :class_name => "Money", :mapping => [ %w(unit_price, cents) ] def formatted_unit_price self.unit_price_object.format(:html) end def formatted_unit_price=(price) self.unit_price_object = Money.new(price) end When I try to open a form with this line: <%= text_field ''product_price[]'', ''formatted_unit_price'', :size => 8 %> I get this error: uninitialized constant Money Any thoughts? Matt -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 9/18/06 8:19 PM, "Matt Rose" <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I get this error: > > uninitialized constant Money > > Any thoughts? > > MattIt might be a case issue with your include statement. Try an all lowercase: require ''money'' ~ Mike -- Work: http://ClickableBliss.com Play: http://MikeZornek.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 9/19/06, Matt Rose <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Ok, I know I''m missing something obvious here, but I can''t spot it. I > installed the money gem. > > I''ve got this in my model: > > composed_of :unit_price_object, :class_name => "Money", :mapping => [ > %w(unit_price, cents) ] > > def formatted_unit_price > self.unit_price_object.format(:html) > end > > def formatted_unit_price=(price) > self.unit_price_object = Money.new(price) > end > > When I try to open a form with this line: > > <%= text_field ''product_price[]'', ''formatted_unit_price'', :size => 8 > %> > > I get this error: > > uninitialized constant Money > > Any thoughts? > > MattI haven''t used the Money gem before, but have you required it? require ''rubygems'' require ''money'' --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Thanks Mike and Daniel - I actually hadn''t required it. But now I get: /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'': no such file to load -- Money I tried it upper and lower case. gem list gives me: money (1.7.1) Class aiding in the handling of Money. So it''s in there. What am I missing? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---