Comments on: Breadcrumbs in Rails https://onlineaspect.com/2010/06/19/breadcrumbs-in-rails/ building stuff on the web with Josh Fraser Sun, 12 Dec 2010 21:42:45 +0000 hourly 1 By: Anu https://onlineaspect.com/2010/06/19/breadcrumbs-in-rails/comment-page-1/#comment-1365 Sun, 12 Dec 2010 21:42:45 +0000 https://onlineaspect.com/?p=772#comment-1365 In reply to Anthony Greeb.

Good point!

]]>
By: Josh Fraser https://onlineaspect.com/2010/06/19/breadcrumbs-in-rails/comment-page-1/#comment-1035 Tue, 29 Jun 2010 06:59:35 +0000 https://onlineaspect.com/?p=772#comment-1035 In reply to Anthony Greeb.

Thanks for sharing. Interesting stuff.

]]>
By: Anthony Greeb https://onlineaspect.com/2010/06/19/breadcrumbs-in-rails/comment-page-1/#comment-1034 Tue, 29 Jun 2010 06:49:12 +0000 https://onlineaspect.com/?p=772#comment-1034 Worth reading "The problem with breadcrumb trails" before going all out http://derivadow.com/2010/02/18/the-problem-with-

]]>
By: @randland https://onlineaspect.com/2010/06/19/breadcrumbs-in-rails/comment-page-1/#comment-1023 Tue, 22 Jun 2010 15:56:11 +0000 https://onlineaspect.com/?p=772#comment-1023 In reply to @mtodd.

Rewrote breadcrumb generator to handle resources and actions via Routes.recognize_path… http://gist.github.com/448656

]]>
By: weppos https://onlineaspect.com/2010/06/19/breadcrumbs-in-rails/comment-page-1/#comment-1019 Mon, 21 Jun 2010 09:12:03 +0000 https://onlineaspect.com/?p=772#comment-1019 Sometimes, you can't rely on the URL because it doesn't contain all the necessary information.
For this reason (and to get more flexibility), I created http://github.com/weppos/breadcrumbs_on_rails.

Feel free to try it and let me know your feedback 🙂

]]>
By: @indirect https://onlineaspect.com/2010/06/19/breadcrumbs-in-rails/comment-page-1/#comment-1013 Sun, 20 Jun 2010 07:40:14 +0000 https://onlineaspect.com/?p=772#comment-1013 Nearly all that code is unnecessary if you are using resources in Rails. You don't even need to parse the URL (which is kind of gross, IMHO). Something like this should do everything: http://gist.github.com/445652

]]>
By: Josh Fraser https://onlineaspect.com/2010/06/19/breadcrumbs-in-rails/comment-page-1/#comment-1010 Sun, 20 Jun 2010 06:25:16 +0000 https://onlineaspect.com/?p=772#comment-1010 In reply to @mtodd.

oooh very nice. i like that a lot.

]]>
By: @mtodd https://onlineaspect.com/2010/06/19/breadcrumbs-in-rails/comment-page-1/#comment-1009 Sun, 20 Jun 2010 06:18:58 +0000 https://onlineaspect.com/?p=772#comment-1009 Thinking about it, I was kinda disappointed that there wasn't an obvious way to iterate over an array with the previous and the next elements conveniently available. Seeing the Enumerable#each_cons method, I saw that it was most like what I wanted, so I decided to hack this together:
http://gist.github.com/445605

Wrapping this further there may be a way to define methods Enumerable#first? and Enumerable#last? to make it easier to add tests without requiring tracking the index, et al.

]]>
By: @mtodd https://onlineaspect.com/2010/06/19/breadcrumbs-in-rails/comment-page-1/#comment-1008 Sun, 20 Jun 2010 06:05:46 +0000 https://onlineaspect.com/?p=772#comment-1008 Just to clarify, I changed the call to Record#name to be Record#display_name and then I would define a custom method on each of the models that would show up in the breadcrumb, allowing for lots of customization and defaults. For example:

class User < ActiveRecord::Base
def display_name
"%s %s" % [self.first_name, self.last_initial]
end
end

or even

class Post < ActiveRecord::Base
alias_method :display_name, :title
end

]]>
By: Josh Fraser https://onlineaspect.com/2010/06/19/breadcrumbs-in-rails/comment-page-1/#comment-1006 Sun, 20 Jun 2010 05:39:33 +0000 https://onlineaspect.com/?p=772#comment-1006 In reply to @beerlington.

tried that. still no luck.

]]>