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 ?
ruby-on-rails api rest
New contributor
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.
add a comment |
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 ?
ruby-on-rails api rest
New contributor
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
add a comment |
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 ?
ruby-on-rails api rest
New contributor
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
ruby-on-rails api rest
New contributor
New contributor
edited Nov 13 at 10:51
BCdotWEB
8,47511638
8,47511638
New contributor
asked Nov 13 at 10:40
Mike W
11
11
New contributor
New contributor
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
add a comment |
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
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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