How to add percentage in ruby on rails route constraintPass a percent (%) sign in a url and get exact value of it using phpHow can I “pretty” format my JSON output in Ruby on Rails?How to get a random number in RubyA concise explanation of nil v. empty v. blank in Ruby on RailsHow can I rename a database column in a Ruby on Rails migration?How do I get the current absolute URL in Ruby on Rails?Ruby on Rails Server optionsPurge or recreate a Ruby on Rails databaseBest practices to handle routes for STI subclasses in railsRails Routing (root :to => …)Format constraint in wildcard route
What is the metal bit in the front of this propeller spinner?
Book in which the "mountain" in the distance was a hole in the flat world
Why is the UH-60 tail rotor canted?
Pass USB 3.0 connection through D-SUB connector
Host telling me to cancel my booking in exchange for a discount?
Can a creature sustain itself by eating its own severed body parts?
Count the identical pairs in two lists
How can I disable a reserved profile?
Create Circle with Inner Radius
How to deal with making design decisions
Impact of throwing away fruit waste on a peak > 3200 m above a glacier
My current job follows "worst practices". How can I talk about my experience in an interview without giving off red flags?
Does switching on an old games console without a cartridge damage it?
Would using carbon dioxide as fuel work to reduce the greenhouse effect?
How should I handle a question regarding my regrets during an interview?
How can I show that the speed of light in vacuum is the same in all reference frames?
Monday's Blocking Donimoes Problem
Help!. Wiring an IKEA light fixture into old fixture
Counterexample finite intersection property
If hash functions append the length, why does length extension attack work?
What are "the high ends of castles" called?
What kind of curve (or model) should I fit to my percentage data?
Why did modems have speakers?
Acoustic guitar chords' positions vs those of a Bass guitar
How to add percentage in ruby on rails route constraint
Pass a percent (%) sign in a url and get exact value of it using phpHow can I “pretty” format my JSON output in Ruby on Rails?How to get a random number in RubyA concise explanation of nil v. empty v. blank in Ruby on RailsHow can I rename a database column in a Ruby on Rails migration?How do I get the current absolute URL in Ruby on Rails?Ruby on Rails Server optionsPurge or recreate a Ruby on Rails databaseBest practices to handle routes for STI subclasses in railsRails Routing (root :to => …)Format constraint in wildcard route
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
How to add percentage and . in search string rails constrains. It's giving No route matches [GET] (Actually it's a GET Request)
Here is my constraint
get "/external_id/:external_id",
controller: "XXXXXXX",
action: "show_by_login_name",
constraints: external_id: /[a-zA-Z0-9.]%+/
ruby-on-rails
add a comment |
How to add percentage and . in search string rails constrains. It's giving No route matches [GET] (Actually it's a GET Request)
Here is my constraint
get "/external_id/:external_id",
controller: "XXXXXXX",
action: "show_by_login_name",
constraints: external_id: /[a-zA-Z0-9.]%+/
ruby-on-rails
Please add link examples that you're trying to handle
– Vasfed
Mar 26 at 13:49
@Vasfed For your reference localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/… localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/… localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/…
– Krishna Maheswara
Mar 26 at 16:36
add a comment |
How to add percentage and . in search string rails constrains. It's giving No route matches [GET] (Actually it's a GET Request)
Here is my constraint
get "/external_id/:external_id",
controller: "XXXXXXX",
action: "show_by_login_name",
constraints: external_id: /[a-zA-Z0-9.]%+/
ruby-on-rails
How to add percentage and . in search string rails constrains. It's giving No route matches [GET] (Actually it's a GET Request)
Here is my constraint
get "/external_id/:external_id",
controller: "XXXXXXX",
action: "show_by_login_name",
constraints: external_id: /[a-zA-Z0-9.]%+/
ruby-on-rails
ruby-on-rails
asked Mar 26 at 13:34
Krishna MaheswaraKrishna Maheswara
2012 silver badges7 bronze badges
2012 silver badges7 bronze badges
Please add link examples that you're trying to handle
– Vasfed
Mar 26 at 13:49
@Vasfed For your reference localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/… localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/… localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/…
– Krishna Maheswara
Mar 26 at 16:36
add a comment |
Please add link examples that you're trying to handle
– Vasfed
Mar 26 at 13:49
@Vasfed For your reference localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/… localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/… localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/…
– Krishna Maheswara
Mar 26 at 16:36
Please add link examples that you're trying to handle
– Vasfed
Mar 26 at 13:49
Please add link examples that you're trying to handle
– Vasfed
Mar 26 at 13:49
@Vasfed For your reference localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/… localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/… localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/…
– Krishna Maheswara
Mar 26 at 16:36
@Vasfed For your reference localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/… localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/… localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/…
– Krishna Maheswara
Mar 26 at 16:36
add a comment |
1 Answer
1
active
oldest
votes
Please modify your regex to use the following code
/[0-z.%]+/
Explanation:
Your current regex /[a-zA-Z0-9.]%+/
reads as:
- match a single character from the list:
[a-zA-Z0-9.]
- match one or more occurrences of
%
So, if your :external_id
is: something%else
, the pattern matches only g%
.
In the future, if you are not sure about regex, you can always test it with tools such as regex101
The above regex will works fine but still i am getting bad request thanks for your answer. localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/… Puma caught this error: bad URI(is not URI?): "/api/organizations/xxxxxxxxxxx/users/external_id/testu000Et" (URI::InvalidURIError)
– Krishna Maheswara
Mar 26 at 16:31
@KrishnaMaheswara when you want to send%
in the URL, please use%25
instead (stackoverflow.com/a/17342786/2039726). Is it working then?
– MrShemek
Mar 26 at 16:49
it's not working
– Krishna Maheswara
Mar 27 at 5:02
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55358493%2fhow-to-add-percentage-in-ruby-on-rails-route-constraint%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Please modify your regex to use the following code
/[0-z.%]+/
Explanation:
Your current regex /[a-zA-Z0-9.]%+/
reads as:
- match a single character from the list:
[a-zA-Z0-9.]
- match one or more occurrences of
%
So, if your :external_id
is: something%else
, the pattern matches only g%
.
In the future, if you are not sure about regex, you can always test it with tools such as regex101
The above regex will works fine but still i am getting bad request thanks for your answer. localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/… Puma caught this error: bad URI(is not URI?): "/api/organizations/xxxxxxxxxxx/users/external_id/testu000Et" (URI::InvalidURIError)
– Krishna Maheswara
Mar 26 at 16:31
@KrishnaMaheswara when you want to send%
in the URL, please use%25
instead (stackoverflow.com/a/17342786/2039726). Is it working then?
– MrShemek
Mar 26 at 16:49
it's not working
– Krishna Maheswara
Mar 27 at 5:02
add a comment |
Please modify your regex to use the following code
/[0-z.%]+/
Explanation:
Your current regex /[a-zA-Z0-9.]%+/
reads as:
- match a single character from the list:
[a-zA-Z0-9.]
- match one or more occurrences of
%
So, if your :external_id
is: something%else
, the pattern matches only g%
.
In the future, if you are not sure about regex, you can always test it with tools such as regex101
The above regex will works fine but still i am getting bad request thanks for your answer. localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/… Puma caught this error: bad URI(is not URI?): "/api/organizations/xxxxxxxxxxx/users/external_id/testu000Et" (URI::InvalidURIError)
– Krishna Maheswara
Mar 26 at 16:31
@KrishnaMaheswara when you want to send%
in the URL, please use%25
instead (stackoverflow.com/a/17342786/2039726). Is it working then?
– MrShemek
Mar 26 at 16:49
it's not working
– Krishna Maheswara
Mar 27 at 5:02
add a comment |
Please modify your regex to use the following code
/[0-z.%]+/
Explanation:
Your current regex /[a-zA-Z0-9.]%+/
reads as:
- match a single character from the list:
[a-zA-Z0-9.]
- match one or more occurrences of
%
So, if your :external_id
is: something%else
, the pattern matches only g%
.
In the future, if you are not sure about regex, you can always test it with tools such as regex101
Please modify your regex to use the following code
/[0-z.%]+/
Explanation:
Your current regex /[a-zA-Z0-9.]%+/
reads as:
- match a single character from the list:
[a-zA-Z0-9.]
- match one or more occurrences of
%
So, if your :external_id
is: something%else
, the pattern matches only g%
.
In the future, if you are not sure about regex, you can always test it with tools such as regex101
edited Mar 26 at 14:34
answered Mar 26 at 14:26
MrShemekMrShemek
1,9541 gold badge11 silver badges14 bronze badges
1,9541 gold badge11 silver badges14 bronze badges
The above regex will works fine but still i am getting bad request thanks for your answer. localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/… Puma caught this error: bad URI(is not URI?): "/api/organizations/xxxxxxxxxxx/users/external_id/testu000Et" (URI::InvalidURIError)
– Krishna Maheswara
Mar 26 at 16:31
@KrishnaMaheswara when you want to send%
in the URL, please use%25
instead (stackoverflow.com/a/17342786/2039726). Is it working then?
– MrShemek
Mar 26 at 16:49
it's not working
– Krishna Maheswara
Mar 27 at 5:02
add a comment |
The above regex will works fine but still i am getting bad request thanks for your answer. localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/… Puma caught this error: bad URI(is not URI?): "/api/organizations/xxxxxxxxxxx/users/external_id/testu000Et" (URI::InvalidURIError)
– Krishna Maheswara
Mar 26 at 16:31
@KrishnaMaheswara when you want to send%
in the URL, please use%25
instead (stackoverflow.com/a/17342786/2039726). Is it working then?
– MrShemek
Mar 26 at 16:49
it's not working
– Krishna Maheswara
Mar 27 at 5:02
The above regex will works fine but still i am getting bad request thanks for your answer. localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/… Puma caught this error: bad URI(is not URI?): "/api/organizations/xxxxxxxxxxx/users/external_id/testu000Et" (URI::InvalidURIError)
– Krishna Maheswara
Mar 26 at 16:31
The above regex will works fine but still i am getting bad request thanks for your answer. localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/… Puma caught this error: bad URI(is not URI?): "/api/organizations/xxxxxxxxxxx/users/external_id/testu000Et" (URI::InvalidURIError)
– Krishna Maheswara
Mar 26 at 16:31
@KrishnaMaheswara when you want to send
%
in the URL, please use %25
instead (stackoverflow.com/a/17342786/2039726). Is it working then?– MrShemek
Mar 26 at 16:49
@KrishnaMaheswara when you want to send
%
in the URL, please use %25
instead (stackoverflow.com/a/17342786/2039726). Is it working then?– MrShemek
Mar 26 at 16:49
it's not working
– Krishna Maheswara
Mar 27 at 5:02
it's not working
– Krishna Maheswara
Mar 27 at 5:02
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55358493%2fhow-to-add-percentage-in-ruby-on-rails-route-constraint%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Please add link examples that you're trying to handle
– Vasfed
Mar 26 at 13:49
@Vasfed For your reference localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/… localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/… localhost:15302/v1/internal/organizations/xxxxxxxxxx/users/…
– Krishna Maheswara
Mar 26 at 16:36