开发者

NameError in MoviesController#index

I generated movie model, and a movies folder to Controllers. I deleted index.html in public_html folder, because I want start the movie page, so I edited the routers.rb file with 2 new line:

  map.resources :movies
  map.index '/', :controller=>"movies", :action=>"index"

I start the application, but something wrong. The error message: NameError in开发者_开发问答 MoviesController#index uninitialized constant MoviesController

I think the problem is in the controller part. the folder structure:

+controllers

-movie

--_index.erb

--index.html.erb (with <%= render :partial=>"index", :collection=>@movies%>)

application.rb


Your folder structure is odd.

You should have the following folders in app: controllers, helpers, models and views.

You should have the following files in app/controllers: application_controller.rb, movies_controller.rb

You should have the following files in app/views/movies: index.html.erb and _index.html.erb (though it's a bit odd to use a partial like this).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜