Click here to Skip to main content
15,892,737 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,

I have created one controller and added default 7 action methods , I have also created 4 views and those are index , new , show , edit all contains difeent data

also added resources :posts controller configuration into my routing file as well
'
My problem is when i try to navigate to index or edit views using url .. it displays me only show views , however index method is working as a default

below are my urls

1 . http://localhost:3000/posts/index[^]

if i try this it gives me show view data

2. localhost:3000/posts

this gives me proper index data (default without mentioning index action name)

3. http://localhost:3000/posts/edit[^]

this one but always shows me data present in show view and not in data present in edit view

Please suggest

Below are few lines from my route file.

Rails.application.routes.draw do
  get 'home/index'
  resources :posts

  # The priority is based upon order of creation: first created -> highest priority.
  # See how all your routes lay out with "rake routes".

  # You can have the root of your site routed with "root"
  root 'home#index'
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900