Can't pull up relation of table ending in 's'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jpstokes
    New Member
    • Sep 2011
    • 18

    Can't pull up relation of table ending in 's'

    I have a table called 'Wbs'. I've generate the controller which works fine when executing from the command line.

    Example:

    Code:
    irb>Wbs <enter> 
    
    Wbs(id: integer, description: string, project_id: integer, wbs_no: string, published: boolean, created_at: datetime, updated_at: datetime))
    The problem is when I attempt to return all Wbs objects for a given project. Rails removes the 's' from wbs and tries to make a call to a method called "Project::W b" instead of "Project::W bs".

    Example:

    Code:
    irb>Projects.first.wbs   
    
    Project Load (0.4ms)  SELECT "projects".* FROM "projects" LIMIT 1
    NameError: uninitialized constant Project::Wb
    I do have belong_to and has_many set in their respective models.

    How can I resolve this issue?
Working...