Comments (5)
I have the same problem: I want to deploy my application to a subfolder, but the routes are specified to the root folder. Is there anything i can do?
from routing-filter.
If you're having issues with locales, you should be able to use standard rails 3 routing to do the trick.
You see, at the time, I wanted to generate routes like this:
scope "(:locale)", :locale => /en|de/ do
resources :posts
resources :categories
end
This would mean that I could go to "/en/posts" or "/de/posts" depending on the language and "/posts" would dispatch to "/en/posts" by default.
The problem was that, since the ":locale" part was optional, the standard rails helpers wouldn't work properly. For example, post_path(@post)
would simply break. This is why I tried to use this plugin instead. Since then, it appears that this has been resolved somehow within rails. I'm not sure which version fixes that, since I never bothered to check, but the latest stable, 3.0.7, should be okay -- you could just remove this plugin and try it out with standard routing. If you haven't seen it, take a look at the article in the rails guides: http://guides.rubyonrails.org/i18n.html#setting-the-locale-from-the-url-params
If you're not using rails 3, though, I'm afraid I can't be of any help.
from routing-filter.
Thanks for your help. The last time I try this solution, i had the same problems with the helper methods. I solved my problem with editing the locale filter in that way:
def prepend_segment!(result, segment)
url = result.is_a?(Array) ? result.first : result
url.sub!(%r(^(http.?://[^/]*)?(.*))) {
t1 = $1
t2 = $2
if t2.to_s.start_with? "/portal"
t1 = t1.to_s ? t1.to_s+"/portal" : "/portal"
t2 = t2[7..t2.length-1]
end
"#{t1}/#{segment}#{t2 == '/' ? '' : t2}"
}
end
from routing-filter.
Yes, that seems like it should work just fine for your particular app. Still, I'd recommend updating rails and trying out the standard routing again, just in case. You can always revert it later if it breaks :).
from routing-filter.
I have related problem where other gems expect that Rails root_url is ending with slash. While using routing-filter root_url is not ending with slash anymore. This is caused by this block "{$2 == '/' ? '' : $2}". Quick fix would be remove the check and let the line be like this: "url.sub!(%r(^(http.?://[^/])?(.))) { "#{$1}/#{segment}#{$2}" }" but then extension filter tests would fail.
from routing-filter.
Related Issues (20)
- 0.4.0.pre Does Not Do Proper Routing HOT 5
- Didn't work on rails 4 HOT 2
- Is this gem support alive? HOT 2
- Devise "Not found. Authentication passthru."
- rails4 undefined local variable or method map HOT 5
- Set :include_default_locale to true ignored HOT 5
- Support for case insensitive locales HOT 9
- Is there a plan to support Rails 5 ?
- New release ? HOT 8
- How to use filter in a block?
- I'm not able to make a custom filter work
- Routing Error instead of fallback to en
- Avoiding duplicate content SEO penalty HOT 2
- Why default locale is not fallen back to? HOT 1
- Update routing-filter to allow rails 5.2
- Won't work with Rails 6.1 HOT 5
- Please release new gem version HOT 4
- Filter locale breaks default_url_options in tests (setting the Locale from URL Params)
- README and repo description (on github) reference artweb-design HOT 1
- routing-filter doesn't seem to work with rails 7.1 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from routing-filter.