Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 5 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 17 additions and 8 deletions.
  1. +4 −0 CHANGELOG
  2. +6 −3 README.textile
  3. +7 −5 lib/crummy/action_controller.rb
View
4 CHANGELOG
@@ -1,3 +1,7 @@
+1.3.5
+* [FIXED] Spacing in name argument was causing errors.
+* [FIXED] Bug where everything was getting parsed as an Array.
+
1.3
* [FIXED] html_safe! is no longer called by default. That's the user's prerogative to do now.
* [ADDED] Allow record to respond to to_s even if you pass a url or block.
View
9 README.textile
@@ -10,7 +10,7 @@ Simply add the dependency to your Gemfile:
<pre>
<code>
- gem "crummy", "~> 1.3"
+ gem "crummy", "~> 1.3.5"
</code>
</pre>
@@ -82,7 +82,7 @@ Render links in the output. Defaults to +true+
<code>:skip_if_blank => true</code>
-With this option, output will be blank if there are no breadcrumps.
+With this option, output will be blank if there are no breadcrumbs.
h3. Examples
@@ -100,11 +100,14 @@ With :format => :html_list you can specify additional params: :active_li_class,
h2. Notes
+Test library is at "Crummy Test":https://github.com/zachinglis/crummy-test
+
h2. Todo
-* Port over rspecs from project to plugin (Fully tested in a project)
+* Accept collections of models as a single argument
* Accept instances of models as a single argument
* Allow for variables in names. (The workaround is to do your own before_filter for that currently)
+* Make a crumbs? type method
h2. Credits
View
12 lib/crummy/action_controller.rb
@@ -18,22 +18,24 @@ def add_crumb(name, *args)
url = instance.send url if url.is_a? Symbol
if url.present?
- if url.kind_of? Enumerable
+ if url.kind_of? Array
url.map! do |name|
name.is_a?(Symbol) ? instance.instance_variable_get("@#{name}") : name
end
end
- url = instance.send :url_for, url unless url.is_a? String
+ if not url.kind_of? String
+ url = instance.send :url_for, url
+ end
end
# Get the return value of the name if its a proc.
- transformed_name = name.is_a?(Proc) ? name.call(instance) : name
+ name = name.call(instance) if name.is_a?(Proc)
- _record = instance.instance_variable_get("@#{transformed_name}")
+ _record = instance.instance_variable_get("@#{name}") unless name.kind_of?(String)
if _record and _record.respond_to? :to_param
instance.add_crumb(_record.to_s, url || instance.url_for(_record))
else
- instance.add_crumb(transformed_name, url)
+ instance.add_crumb(name, url)
end
# FIXME: url = instance.url_for(name) if name.respond_to?("to_param") && url.nil?

No commit comments for this range

Something went wrong with that request. Please try again.