rails custom rest route with parameter -


I have a question controller and an associated model and the rest of the way is how it has been established in the routes. RB:

  Resource: Question   

I want to add a custom route whose format / question / widget is / id (where id question is id of which I want to create a widget for it). I want it to be processed by the "widget" action in my question controller. I have tried many things like:

  resources: questions become members' widget / id: end end   

but nothing is working Doing I'm sure I'm missing some easy thoughts? thank you in advanced.

You do not have to specify the ID after being in the resources. It should look like this:

  Resources: The members' questions are 'widget' and end up.   

You can find more information from See Section 2.9.1.

EDIT: I have seen that you are trying to get / query / widget / ID will set a path to get it / question /: ID / widget is more with this rail conferencing If you really want it in another way, then you have to set a custom match statement:

  match "/ question / widget /: id" = & gt; "Question # Widget"   

However, I have to be with the conference.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -