seyhunak / twitter-bootstrap-rails

Twitter Bootstrap for Rails 6.0, Rails 5 - Rails 4.x Asset Pipeline
https://github.com/seyhunak/twitter-bootstrap-rails
4.49k stars 997 forks source link

add_breadcrumb blows up if breadcrumb url string contains _url #642

Closed kindjar closed 11 years ago

kindjar commented 11 years ago

I have a class called ListingUrl and a corresponding Controller with routes such as "/websites/1/listing_urls/2". When I call add_breadcrumb and give it the url where the breadcrumb should link to, add_breadcrumb throws an exception inside the eval() because it's trying to eval a string which is a URL, not ruby code:

(eval):1: syntax error, unexpected tINTEGER, expecting $end
/websites/1/listing_urls/2

The calling code looks roughly like this:

add_breadcrumb @listing_url.url, website_listing_url_path(@website, @listing_url)

This appears to happen because the eval is invoked not just on symbols, which are used to specify methods to call to generate the necessary URLs, but also on strings, which probably shouldn't be getting eval'ed.