Forum: Ruby on Rails uninitialized constant Model1::Model2::Model3

38ff5c28fb5243abd24978860d54aafb?d=identicon&s=25 Sonali Kapoor (Guest)
on 2013-03-07 23:55
(Received via mailing list)
I am getting `uninitialized constant Project::Forum::Topic` at
app/controllers/home_controller.rb:46:in `discussions'

I have code below and I am converting from `rails 2.3.x` to `rails
I am thinking something wrong in `routes` setting.

Any Idea How can I fix?


    Project < ActiveRecord::Base
      # Relations under project model
      has_many :features, :dependent => :destroy
      has_many :forums, :class_name=>'Forum::Forum'
      has_many :topics, :class_name=>'Forum::Topic', :through=>:forums

    Forum::Forum < Feature
      # Relations under forum model
      has_many :topics, :class_name => 'Forum::Topic', :dependent =>

    Feature < ActiveRecord::Base
      # Relations under feature model
      belongs_to :project

    Forum::Topic < ActiveRecord::Base
       # Relations under topic model
       belongs_to :forum, :foreign_key => :forum_id, :class_name =>
'Forum::Forum', :include => :project


    def discussions
      @project ||= Project.find_by_name 'help'
      @forums = @project.forums
      @topics = @project.topics.recent # HERE I AM GETTING ERRORS


    scope :home, :controller => "home", :activity => 'read' do
     get :discussions, :path => '/forums', :service_type => 'public'
     get :forums, :action => "discussions"

    uninitialized constant Project::Forum::Topic
    app/controllers/home_controller.rb:46:in `discussions'
38ff5c28fb5243abd24978860d54aafb?d=identicon&s=25 unknown (Guest)
on 2013-03-08 18:54
(Received via mailing list)
yes, those are in "app/models/forum", it is working fine with Rails
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.