Fix named route use with Rails 3.2 #50

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+4 −3
Split
@@ -14,9 +14,10 @@ def show
when nil
request.path
end
+
path = path.gsub('//','/')
- path = StaticPage::remove_spree_mount_point(path) unless Rails.application.routes.named_routes[:spree].path == "/"
-
+ path = StaticPage::remove_spree_mount_point(path) unless Rails.application.routes.named_routes[:spree].path.spec.to_s() == "/"
@radar

radar Apr 10, 2012

This'll break backwards compatibility with Rails 3.1, just so you're aware.

We would probably then have to update the Gemfile.

@ethier

ethier Apr 10, 2012

Maybe a new 1-1-stable branch?

@peterberkenbosch

peterberkenbosch Apr 11, 2012

Member

1-1-stable branch is on his way.. will sort things out this evening! Thanks for contributing!

@JDutil

JDutil Apr 19, 2012

Owner

There is already a 1-0-stable branch so this should be fine in master. Does the 1-0-stable branch need to be rebased with master first though? It seems to be several commits behind master, but I'm not sure if there has already been commits other than this that would break compatibility.

@peterberkenbosch did you start working on this already? If not I can later today as I want to get this fix into my app.

@peterberkenbosch

peterberkenbosch Apr 19, 2012

Member

1-0 stable is ahead on master.. need to fix this and create a 1-1-stable branch as well.. this evening and tomorrow are planned for that!

On Apr 19, 2012, at 7:39 PM, Jeff Dutil wrote:

path = path.gsub('//','/')

- path = StaticPage::remove_spree_mount_point(path) unless Rails.application.routes.named_routes[:spree].path == "/"

  • path = StaticPage::remove_spree_mount_point(path) unless Rails.application.routes.named_routes[:spree].path.spec.to_s() == "/"

There is already a 1-0-stable branch so this should be fine in master. Does the 1-0-stable branch need to be rebased with master first though? It seems to be several commits behind master, but I'm not sure if there has already been commits other than this that would break compatibility.

@peterberkenbosch did you start working on this already? If not I can later today as I want to get this fix into my app.


Reply to this email directly or view it on GitHub:
https://github.com/spree/spree_static_content/pull/50/files#r708469

+
unless @page = Spree::Page.visible.find_by_slug(path)
render_404
end
@@ -1,2 +1,2 @@
-<% page_uri = Rails.application.routes.named_routes[:spree].path == '/' ? page.slug : Rails.application.routes.named_routes[:spree].path + page.slug %>
@wandtasie

wandtasie Apr 17, 2012

I think this does the same and is'nt as ugly ;-)
Rails.application.routes.url_helpers.spree_path

maybe someone can shorten it up?

+<% page_uri = Rails.application.routes.named_routes[:spree].path.spec.to_s() == '/' ? page.slug : Rails.application.routes.named_routes[:spree].path.spec.to_s() + page.slug %>
<li class=<%=(request.fullpath.gsub('//','/') == page_uri) ? 'current' : 'not'%>><%= link_to page.title, page_uri %></li>