{"issue":{"state":"open","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"milestone":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/979555d0135ee19dfcc92cb7d04e0ac4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"979555d0135ee19dfcc92cb7d04e0ac4","url":"https://api.github.com/users/matellis","login":"matellis","id":138857},"updated_at":"2011-10-30T22:18:12Z","labels":[],"assignee":null,"comments":5,"closed_at":null,"url":"https://api.github.com/repos/resolve/refinerycms/issues/1114","body":"I'm working with refinerycms-pages and some custom layouts.\r\n\r\nThe custom layouts work like this:\r\n\r\n    # /app/controllers/pages_controller.rb\r\n    class PagesController < ApplicationController\r\n      def home\r\n        error_404 unless (@page = Page.where(:link_url => '/').first).present?\r\n      end\r\n\r\n      def features\r\n        @page = Page.find('features')\r\n      end\r\n    end\r\n\r\n    # /config/routes.rb\r\n    match '/features', :to => 'pages#features'\r\n\r\nWe have two settings/variables in Refinery under our control:\r\n\r\n1. `use_marketable_urls` in `RefineryCMS::Settings`\r\n2. 'Custom Title' in the page's 'advanced options'\r\n\r\nWe want the page 'Features' to be accessible at `/features` and to appear in the menus as such. Our menu code uses the `menu_branch.url` method to get the right URL.\r\n\r\nThanks to the `routes.rb` change our page is *always* available at '/features' but the menus behave differently. Depending on which settings we use we get one of two results:\r\n\r\n1. Page urls in the menu are consistently in the form `/pages/features`\r\n2. Page urls randomly switch between `/features` and `/features-page`\r\n\r\nOur custom layouts only work when you go to `/features`, `/pages/features` and `/features-page` don't trigger the layouts.\r\n\r\nLooking at `refinerycms-pages` code there is a method `sluggable` that should only be run if the Use Marketable Settings is on *and* there is no custom title, but for some reason it seems to randomly run.\r\n\r\nFor now we will simply set the menu URLs statically but I think there's a bug in here somewhere, either in our understanding of the interaction between `sluggable`, `use_marketable_urls` and the Custom Title field.\r\n\r\nAny help would be much appreciated.","html_url":"https://github.com/resolve/refinerycms/issues/1114","title":"Sluggable Problems","number":1114,"id":2091823,"created_at":"2011-10-30T19:31:42Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/1d676127a3e4c0531e2d37dabef0a12d?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"1d676127a3e4c0531e2d37dabef0a12d","url":"https://api.github.com/users/parndt","login":"parndt","id":10128},"updated_at":"2011-10-30T22:18:12Z","url":"https://api.github.com/repos/resolve/refinerycms/issues/comments/2571925","body":"Here is the code that is interfering with you:\r\n\r\nhttps://github.com/resolve/refinerycms/blob/1-0-stable/pages/lib/pages/marketable_routes.rb#L8-L12\r\n\r\nI think if you made your route non-named then it wouldn't conflict.. e.g.\r\n\r\n`get '/features', :to => 'pages#features'`\r\n\r\nNote the lack of `:as => 'features'`","id":2571925,"created_at":"2011-10-30T22:18:12Z"}}