You are here: Forums Ask a Rails expert Associations...
Posted in Forums : Ask a Rails expert
Authority 12
Posting Rating 0
Sign in to rate this post
|
Hi I’m a newbie and need some help i’m getting an error of uninitialized Constant Hierarchy::HierarchyBusinessFunctionTypeCostCenteAccount I’m trying to achieve the equivalent of:- select u.user_name, hbtcca.hierarchy_id, cost_centre_account_id from hierarchy_business_function_type_cost_centre_accounts hbtcca User table user < id integer, User model has_many :hierarchies_as_controller, :class_name => ‘Hierarchy’, :foreign_key => ‘controller’ Hierarchies table id integer, Hierarchies model class Hierarchy < ActiveRecord::Base Hierarchy_business_function_type_cost_centre_accounts (hbftcca) table id, hbftcca model belongs_to :hierarchy business_function_types table |
Authority 25
Posting Rating 98
Sign in to rate this post
|
I didn’t really read the entire post but I can see a typo in this line: I think you want Hierarchy::HierarchyBusinessFunctionTypeCostCentReAccount, correct? |
Authority 12
Posting Rating 96
Sign in to rate this post
|
Raul: well spotted. Colin: You win this month’s “Longest model name” award. Congratulations! Search for hierarchy_business_function_type_cost_cente_account in your source code, and change cente to centre. |
Authority 12
Posting Rating 0
Sign in to rate this post
|
Thanks for the input and your time Sorry, that was a typo in the post not in the models. It is correct in the code. |
Authority 12
Posting Rating 96
Sign in to rate this post
|
Hi Colin The relationship defined seems to fine, Are you running this in production ENV. try restarting the server then. |
Authority 37
Posting Rating 1
Sign in to rate this post
|
But this error: uninitialized Constant B::A is exactly that kind of error that you get if you call A.x inside B and you have a typo in A’s name. Matthias |
Ask a Rails expert : Get disk info
Ask a Rails expert : Problem with rails 2.1.0 & its older versions
Ask a Rails expert : How to test authentication and get the specific error using net:: http class
Ask a Rails expert : AJAX and set focus
Ask a Rails expert : How to use mephisto
Ask a Rails expert : Sanitizing html
Ask a Rails expert : First post, requesting sage perspective
Ask a Rails expert : How to use mephisto
Ask a Rails expert : will_paginate customization problem
Ask a Rails expert : BackgroundRB still wants 'development' environment...?