Show refers to the action in the route and not a command to "show it". Instead you need to define the index action.
Up vote 0 down vote favorite share g+ share fb share tw.
I did rails g controller World and created a new layout also called world. I now have app/views/world/index.html.erb. This is my WorldController: class WorldController End end I do not know what to put in my def show so that I can navigate to localhost:3000/world/index and have the views/world/index page render.
Any help would be appreciated. Ruby-on-rails ruby layout view controller link|improve this question edited Aug 21 '11 at 2:25Dave Newman4,5371713 asked Aug 21 '11 at 2:21user85297453310 74% accept rate.
Show refers to the action in the route and not a command to "show it". Instead you need to define the index action. Def index end If this doesn't work.. there is probably a routing problem.
Show us config/routes.rb.
OK I added def index @msgs = current_user. All_msgs. Paginate(:per_page => 10, :page => params:page) @last_msg = current_user.msgs.
Last end def show @user = User. Find_by_username(params:username) @msg = @user. All_msgs end but now I get undefined method 'all_msgs' for nil:NilClass yet the same def show works in my other views?
– user852974 Aug 21 '11 at 2:49 can you show application_controller. Rb or wherever current_user and login_required is defined? – natedavisolds Aug 23 '11 at 16:15.
Your controller is named "World" in the singular. This typically means your "World" resource is singular. I.e.
There is just one world (not many worlds). If that's the case, there would be no "index". You might define the route like this: resource :world - which would give you the route /world - mapped to WorldsController#show This assumes the resource is singular, and there is only one world.
So you don't need an id to #show it, as it's assumed only one exists (and can be found without an identifier). If you do want multiple worlds, you'd define your routes with: resources :worlds - and you'd end up with the routes: /worlds - mapping to WorldsController#index /world/:id - mapping to WorldsController#show I guess the point is, are there multiple worlds? If there are, then define your routes with resources :worlds.
If there is a single world, define your routes with resource :world. In the latter case, there is no index method (as there is a single World, without need of an index).
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.