Link_to and routing in ruby on rails -
I have to link_to link to localhost: 3000 / questions / 1, but it is still joining localhost: 3000 / Question
Link to the code
& lt;% = link_to
RootsRb file
Rail. Application Arts Scare "/" = & gt; "Get Main_app # index" / location "=> & gt; "Location # location" post "/ location / index" = & gt; Get "Location # Index" / location / index "=> "Location # index" to "/ location / directions" = & gt; Receive '/ logout' for 'Question # index': 'Session # Destroyed' via: "Delete Resources: User, Only: [New, Creating] Resources: Season , Only: [: new, creating] resource: except: [: new] resource: Answer, only: [: create] end / register, for this: 'user # new' / 'login' For: 'session # new' to get '/ logout',: 'session # deleted', via: go to # Question / Remove your_questions: 'Question # Your_Question' Get Origin / Question / Id: ':' Question # Show 'to get' / Question ',' Question # Your_Questation ', like:' Your_Questions' Get '/ search': 'question # search'
Named path must be specified, i.e .::
get / questions /: id ', for:' question # show ', such as:' your_question 'to' / questions'. Get it: 'Question # your_questation', such as: 'your_questions'
This allows the use of your_question_path (1)
, for example,' question / 1 'to refer to
You can also do this with resourceful routing:
resources: questions like:' your_questions', only :: show
Comments
Post a Comment