Skip to content

Commit

Permalink
Fixed routes for model names with two or more words.
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzedge committed Feb 4, 2012
1 parent cbe06cf commit 0ea1260
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/lib/refinery/core.rb
Expand Up @@ -151,7 +151,7 @@ def version
# Refinery.route_for_model(Refinery::Blog::Post) => "blog_admin_post_path"
# Refinery.route_for_model(Refinery::Blog::Post, true) => "blog_admin_posts_path"
def route_for_model(klass, plural = false)
parts = klass.to_s.downcase.split("::").delete_if { |p| p.blank? }
parts = klass.to_s.underscore.split('/').delete_if { |p| p.blank? }

resource_name = plural ? parts[-1].pluralize : parts[-1]

Expand Down

0 comments on commit 0ea1260

Please sign in to comment.