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;








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.]%+/









share|improve this question






















  • 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


















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.]%+/









share|improve this question






















  • 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














0












0








0


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.]%+/









share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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


















  • 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













1 Answer
1






active

oldest

votes


















2














Please modify your regex to use the following code



/[0-z.%]+/


Explanation:



Your current regex /[a-zA-Z0-9.]%+/ reads as:



  1. match a single character from the list: [a-zA-Z0-9.]

  2. 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






share|improve this answer

























  • 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










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
);



);













draft saved

draft discarded


















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









2














Please modify your regex to use the following code



/[0-z.%]+/


Explanation:



Your current regex /[a-zA-Z0-9.]%+/ reads as:



  1. match a single character from the list: [a-zA-Z0-9.]

  2. 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






share|improve this answer

























  • 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















2














Please modify your regex to use the following code



/[0-z.%]+/


Explanation:



Your current regex /[a-zA-Z0-9.]%+/ reads as:



  1. match a single character from the list: [a-zA-Z0-9.]

  2. 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






share|improve this answer

























  • 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













2












2








2







Please modify your regex to use the following code



/[0-z.%]+/


Explanation:



Your current regex /[a-zA-Z0-9.]%+/ reads as:



  1. match a single character from the list: [a-zA-Z0-9.]

  2. 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






share|improve this answer















Please modify your regex to use the following code



/[0-z.%]+/


Explanation:



Your current regex /[a-zA-Z0-9.]%+/ reads as:



  1. match a single character from the list: [a-zA-Z0-9.]

  2. 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







share|improve this answer














share|improve this answer



share|improve this answer








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

















  • 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








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.



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현