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 3.2.11
,
I am thinking something wrong in routes
setting.
Any Idea How can I fix?
models
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 =>
:destroy
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
home_controller.rb
def discussions
@project ||= Project.find_by_name 'help'
@forums = @project.forums
@topics = @project.topics.recent # HERE I AM GETTING ERRORS
end
routes.rb
scope :home, :controller => "home", :activity => 'read' do
get :discussions, :path => '/forums', :service_type => 'public'
get :forums, :action => "discussions"
end
errors
uninitialized constant Project::Forum::Topic
app/controllers/home_controller.rb:46:in `discussions’