rails prefix url

33 views
Skip to first unread message

Claudiu Clau

unread,
Oct 30, 2014, 11:14:30 AM10/30/14
to rubyonra...@googlegroups.com
Hello rails!

I have a question for you and maybe I will get some help :)

I want to prefix my url routes at the end of the url
example:
or

Any idea?

thx!

Claudiu Clau

unread,
Nov 2, 2014, 3:48:53 AM11/2/14
to rubyonra...@googlegroups.com
Hello,

So nobody has any clue how to solved this? :)

Hassan Schroeder

unread,
Nov 2, 2014, 10:32:33 AM11/2/14
to rubyonrails-talk
On Sun, Nov 2, 2014 at 1:48 AM, Claudiu Clau <claudi...@gmail.com> wrote:

> So nobody has any clue how to solved this? :)

Maybe nobody understands what you want to do --

>> I want to prefix my url routes at the end of the url

"prefix" and "at the end" are mutually exclusive.

Perhaps if you gave an example that explicitly shows the "normal"
url *and* the desired url to compare...

--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

Claudiu Clau

unread,
Nov 2, 2014, 11:27:21 AM11/2/14
to rubyonra...@googlegroups.com
Hello,

thx for reply

example

localhost:3000/posts/amazing-post
I want to be: localhost/amazing-post/_post
localhost:3000/cities/berlin
I want to be: localhost:3000/berlin/_city


best

Hassan Schroeder

unread,
Nov 2, 2014, 12:29:33 PM11/2/14
to rubyonrails-talk
On Sun, Nov 2, 2014 at 8:27 AM, Claudiu Clau <claudi...@gmail.com> wrote:

> localhost:3000/posts/amazing-post
> I want to be: localhost/amazing-post/_post
> localhost:3000/cities/berlin
> I want to be: localhost:3000/berlin/_city

So if that's the desired result, what is the problem? You can manually
create whatever arbitrary URLs you like.

That said, I think you'll regret fighting Rails conventions this way :-)

Good luck!

Colin Law

unread,
Nov 2, 2014, 2:46:40 PM11/2/14
to rubyonra...@googlegroups.com
On 2 November 2014 16:27, Claudiu Clau <claudi...@gmail.com> wrote:
> Hello,
>
> thx for reply
>
> example
>
> localhost:3000/posts/amazing-post
> I want to be: localhost/amazing-post/_post
> localhost:3000/cities/berlin
> I want to be: localhost:3000/berlin/_city

Have a look at the Rails Guide on routing and you will see how to use
any route you desire to invoke the appropriate controller#action. Why
on earth you would want to do what you describe is a mystery to me
however.

Colin

>
>
> best
>
> On Sunday, November 2, 2014 4:32:33 PM UTC+1, Hassan Schroeder wrote:
>>
>> On Sun, Nov 2, 2014 at 1:48 AM, Claudiu Clau <claudi...@gmail.com> wrote:
>>
>> > So nobody has any clue how to solved this? :)
>>
>> Maybe nobody understands what you want to do --
>>
>> >> I want to prefix my url routes at the end of the url
>>
>> "prefix" and "at the end" are mutually exclusive.
>>
>> Perhaps if you gave an example that explicitly shows the "normal"
>> url *and* the desired url to compare...
>>
>> --
>> Hassan Schroeder ------------------------ hassan.s...@gmail.com
>> http://about.me/hassanschroeder
>> twitter: @hassan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/c6d672f9-ab52-4094-a3ed-d9b20abee2fa%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages