aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/record_identifier.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-06-06 03:38:05 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2008-06-06 03:38:05 -0700
commit566d717d783f56563cd602198be2177c972c9a81 (patch)
treeff384a6a8c8c83054ff9db6335e6a28d6433aafe /actionpack/lib/action_controller/record_identifier.rb
parentc1a98209da7422965f5dd4f475603b8a3cc887e4 (diff)
downloadrails-566d717d783f56563cd602198be2177c972c9a81.tar.gz
rails-566d717d783f56563cd602198be2177c972c9a81.tar.bz2
rails-566d717d783f56563cd602198be2177c972c9a81.zip
Move Class::ModelName to Active Support module core_ext
Diffstat (limited to 'actionpack/lib/action_controller/record_identifier.rb')
-rw-r--r--actionpack/lib/action_controller/record_identifier.rb20
1 files changed, 2 insertions, 18 deletions
diff --git a/actionpack/lib/action_controller/record_identifier.rb b/actionpack/lib/action_controller/record_identifier.rb
index 77fe5cbe2a..f69c3d6163 100644
--- a/actionpack/lib/action_controller/record_identifier.rb
+++ b/actionpack/lib/action_controller/record_identifier.rb
@@ -1,19 +1,3 @@
-class Class
- def model_name
- @model_name ||= ModelName.new(name)
- end
-
- class ModelName
- attr_reader :singular, :plural, :path
-
- def initialize(name)
- @singular = name.underscore.tr('/', '_').freeze
- @plural = @singular.pluralize.freeze
- @path = "#{name.tableize}/#{name.demodulize.underscore}".freeze
- end
- end
-end
-
module ActionController
# The record identifier encapsulates a number of naming conventions for dealing with records, like Active Records or
# Active Resources or pretty much any other model type that has an id. These patterns are then used to try elevate
@@ -59,9 +43,9 @@ module ActionController
name = model_name_from_record_or_class(record_or_class)
if controller_path && controller_path.include?("/")
- "#{File.dirname(controller_path)}/#{name.path}"
+ "#{File.dirname(controller_path)}/#{name.partial_path}"
else
- name.path
+ name.partial_path
end
end