refinery / refinerycms

An extendable Ruby on Rails CMS that supports Rails 6.0+
https://www.refinerycms.com/
MIT License
3.9k stars 1.26k forks source link

Extensions broken on fresh install 2.0.8. #1984

Closed dfischer closed 12 years ago

dfischer commented 12 years ago

I was trying to follow the guide on how to create a RefineryCMS install and a demo extension and I got the following error upon visiting http://localhost:3000/events

Routing Error

No route matches {:locale=>:en, :controller=>"refinery/events/events"}
Thoughts on how to fix? It's part of the guides so I'm not sure why it wouldn't work.

Furthermore, trying another extension like inquiries results in a similar error:
No route matches {:locale=>:en, :controller=>"refinery/inquiries/inquiries", :action=>"new"}

Thoughts? Am I doing something wrong or is there a bug in Refinery?

dfischer commented 12 years ago

I found the issue causing it.

It appears that anytime you have a link_to it must have a supplemented route (even if empty) otherwise it causes a routing issue.

E.g, I had several links that were placeholders like this

  = link_to 'Home'
  = link_to 'Betterfrontend'
  = link_to 'About'

This code in application.html.haml caused it to fail until I switched it over to:

  = link_to 'Home', ''
  = link_to 'Betterfrontend', ''
  = link_to 'About', ''
ugisozols commented 12 years ago

This is not the first time I see this "issue" but tbh I'm not sure how can we fix this...

parndt commented 12 years ago

I don't know why you would put a link_to without a url

dfischer commented 12 years ago

Sometimes you stub something out for a design. Either way it shouldn't break like that.

On Mon, Oct 15, 2012 at 12:59 PM, Philip Arndt notifications@github.comwrote:

I don't know why you would put a link_to without a url

— Reply to this email directly or view it on GitHubhttps://github.com/refinery/refinerycms/issues/1984#issuecomment-9459268.

parndt commented 12 years ago

Does this happen only with Refinery or also with other things like Spree or a simple Rails mountable engine?

robyurkowski commented 12 years ago

When you don't pass any arguments, Rails will call url_for with no options, which triggers polymorphic_path with no options, which calls polymorphic_url({}, {:routing_type => :path}), which calls...

I stopped at about 20 levels deep. From what I see, Rails is just simply not designed to handle link_to without a second argument. I know it's a splat, but you should simply consider appending '' or '#' as the argument, @dfischer.