我uninitialized constant Project::Forum::Topic
正在
app/controllers/home_controller.rb:46:in `discussions'
我有下面的代码,我正在从 转换rails 2.3.x
为rails 3.2.11
,我认为routes
设置有问题。
任何想法我该如何解决?
楷模
class 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
class Forum::Forum < Feature
# Relations under forum model
has_many :topics, :class_name => 'Forum::Topic', :dependent => :destroy
class Feature < ActiveRecord::Base
# Relations under feature model
belongs_to :project
class 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
路线.rb
scope :home, :controller => "home", :activity => 'read' do
get :discussions, :path => '/forums', :service_type => 'public'
get :forums, :action => "discussions"
end
错误
uninitialized constant Project::Forum::Topic
app/controllers/home_controller.rb:46:in `discussions'