SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Threaded View

  1. #1
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ActiveRecord Issues - Uninitialized Contant

    Hi,

    Just having a play around with RoR for a few little automation tasks and it's doing my nut in right now. I've got two models:

    Item:
    Code:
    class Item < ActiveRecord::Base
      belongs_to :something
    end
    Something:
    Code:
    class SomeThing < ActiveRecord::Base
        has_many :items
    end
    The table for items has: something_id column in it.

    Yet when I try:
    Code:
    <%=h item.something.value %>
    I get:
    Code:
    uninitialized constant Item::Something
    and it's doing my head in right now as to why it isn't working.

    It's bound to be something simple that I'm just not seeing, having come from many years with PHP.

    Cheers,
    Last edited by Karl; Nov 4, 2010 at 03:41.
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting
    Call 0800 542 9764 today and ask how we can help your business grow.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •