Two GET methods with different query parameters : REST [on hold]











up vote
-2
down vote

favorite












I'm working on a rails project, where I have a Transaction model.
This model has a id and a provider_id attributes. (amongst others).
I need to be able to retrieve my instances based on id, and on provider_id
So, should I use the same route



transactions/:id(.:format)
with a implementation in the controller such as this :



@transaction = Transaction.where("uuid=? or provider_id = ?", params[:id], params[:id])



but then can I have 2 parameter names id, and provider_id ?



or should I have 2 separates routes ?










share|improve this question









New contributor




Mike W is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as off-topic by Ludisposed, BCdotWEB, Mast, Toby Speight, Heslacher Nov 13 at 11:10


This question appears to be off-topic. The users who voted to close gave these specific reasons:



  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Mast, Toby Speight, Heslacher

  • "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – Ludisposed, BCdotWEB


If this question can be reworded to fit the rules in the help center, please edit the question.









  • 1




    Questions asking for advice about code not yet written are off-topic. Please follow the tour and read "How do I ask a good question?", "What topics can I ask about here?" and "What types of questions should I avoid asking?".
    – BCdotWEB
    Nov 13 at 10:51















up vote
-2
down vote

favorite












I'm working on a rails project, where I have a Transaction model.
This model has a id and a provider_id attributes. (amongst others).
I need to be able to retrieve my instances based on id, and on provider_id
So, should I use the same route



transactions/:id(.:format)
with a implementation in the controller such as this :



@transaction = Transaction.where("uuid=? or provider_id = ?", params[:id], params[:id])



but then can I have 2 parameter names id, and provider_id ?



or should I have 2 separates routes ?










share|improve this question









New contributor




Mike W is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as off-topic by Ludisposed, BCdotWEB, Mast, Toby Speight, Heslacher Nov 13 at 11:10


This question appears to be off-topic. The users who voted to close gave these specific reasons:



  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Mast, Toby Speight, Heslacher

  • "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – Ludisposed, BCdotWEB


If this question can be reworded to fit the rules in the help center, please edit the question.









  • 1




    Questions asking for advice about code not yet written are off-topic. Please follow the tour and read "How do I ask a good question?", "What topics can I ask about here?" and "What types of questions should I avoid asking?".
    – BCdotWEB
    Nov 13 at 10:51













up vote
-2
down vote

favorite









up vote
-2
down vote

favorite











I'm working on a rails project, where I have a Transaction model.
This model has a id and a provider_id attributes. (amongst others).
I need to be able to retrieve my instances based on id, and on provider_id
So, should I use the same route



transactions/:id(.:format)
with a implementation in the controller such as this :



@transaction = Transaction.where("uuid=? or provider_id = ?", params[:id], params[:id])



but then can I have 2 parameter names id, and provider_id ?



or should I have 2 separates routes ?










share|improve this question









New contributor




Mike W is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I'm working on a rails project, where I have a Transaction model.
This model has a id and a provider_id attributes. (amongst others).
I need to be able to retrieve my instances based on id, and on provider_id
So, should I use the same route



transactions/:id(.:format)
with a implementation in the controller such as this :



@transaction = Transaction.where("uuid=? or provider_id = ?", params[:id], params[:id])



but then can I have 2 parameter names id, and provider_id ?



or should I have 2 separates routes ?







ruby-on-rails api rest






share|improve this question









New contributor




Mike W is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Mike W is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Nov 13 at 10:51









BCdotWEB

8,47511638




8,47511638






New contributor




Mike W is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 13 at 10:40









Mike W

11




11




New contributor




Mike W is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Mike W is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Mike W is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




put on hold as off-topic by Ludisposed, BCdotWEB, Mast, Toby Speight, Heslacher Nov 13 at 11:10


This question appears to be off-topic. The users who voted to close gave these specific reasons:



  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Mast, Toby Speight, Heslacher

  • "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – Ludisposed, BCdotWEB


If this question can be reworded to fit the rules in the help center, please edit the question.




put on hold as off-topic by Ludisposed, BCdotWEB, Mast, Toby Speight, Heslacher Nov 13 at 11:10


This question appears to be off-topic. The users who voted to close gave these specific reasons:



  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Mast, Toby Speight, Heslacher

  • "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – Ludisposed, BCdotWEB


If this question can be reworded to fit the rules in the help center, please edit the question.








  • 1




    Questions asking for advice about code not yet written are off-topic. Please follow the tour and read "How do I ask a good question?", "What topics can I ask about here?" and "What types of questions should I avoid asking?".
    – BCdotWEB
    Nov 13 at 10:51














  • 1




    Questions asking for advice about code not yet written are off-topic. Please follow the tour and read "How do I ask a good question?", "What topics can I ask about here?" and "What types of questions should I avoid asking?".
    – BCdotWEB
    Nov 13 at 10:51








1




1




Questions asking for advice about code not yet written are off-topic. Please follow the tour and read "How do I ask a good question?", "What topics can I ask about here?" and "What types of questions should I avoid asking?".
– BCdotWEB
Nov 13 at 10:51




Questions asking for advice about code not yet written are off-topic. Please follow the tour and read "How do I ask a good question?", "What topics can I ask about here?" and "What types of questions should I avoid asking?".
– BCdotWEB
Nov 13 at 10:51















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Сан-Квентин

8-я гвардейская общевойсковая армия

Алькесар