Permalink
Browse files

No need to have #generate and #generate_extras per instance

  • Loading branch information...
jeremy committed Nov 26, 2008
1 parent 6599dd9 commit a88094fd7a19a4b2d5c5b5044b10146e6c5c7245
Showing with 10 additions and 5 deletions.
  1. +10 −5 actionpack/lib/action_controller/routing/route.rb
@@ -122,6 +122,16 @@ def freeze
super
end
+ def generate(options, hash, expire_on = {})
+ path, hash = generate_raw(options, hash, expire_on)
+ append_query_string(path, hash, extra_keys(options))
+ end
+
+ def generate_extras(options, hash, expire_on = {})
+ path, hash = generate_raw(options, hash, expire_on)
+ [path, extra_keys(options)]
+ end
+
private
def requirement_for(key)
return requirements[key] if requirements.key? key
@@ -150,11 +160,6 @@ def write_generation!
# the query string. (Never use keys from the recalled request when building the
# query string.)
- method_decl = "def generate(#{args})\npath, hash = generate_raw(options, hash, expire_on)\nappend_query_string(path, hash, extra_keys(options))\nend"
- instance_eval method_decl, "generated code (#{__FILE__}:#{__LINE__})"
-
- method_decl = "def generate_extras(#{args})\npath, hash = generate_raw(options, hash, expire_on)\n[path, extra_keys(options)]\nend"
- instance_eval method_decl, "generated code (#{__FILE__}:#{__LINE__})"
raw_method
end

0 comments on commit a88094f

Please sign in to comment.