我有以下兩種模式:建模問題
class Project < ActiveRecord::Base
has_many :photoalbums
end
class PhotoAlbum < ActiveRecord::Base
belongs_to :space
end
的routes.rb:
resources :projects do
resources :photo_albums
end
我試圖在控制器做的就是讓所有的項目photoalbums的列表:
class PhotoAlbumsController < ApplicationController
def index
@project = Project.find(params[:project_id])
@photoalbums = @project.photoalbums.all
end
end
但我收到以下錯誤?
uninitialized constant Project::Photoalbum
謝謝謝謝!該死的_總是把我搞砸了。 – user479959 2010-10-23 22:02:48
如果它對您有幫助,請接受並評價答案。 – nathanvda 2010-10-24 13:27:40