Changeset 6102
- Timestamp:
- 02/02/07 18:12:11 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/simply_helpful/lib/simply_helpful/controller_extensions.rb
r6098 r6102 5 5 edit_polymorphic_url edit_polymorphic_path 6 6 new_polymorphic_url new_polymorphic_path 7 formatted_polymorphic_url formatted_polymorphic_path 7 8 ) 8 9 … … 33 34 end 34 35 end 36 35 37 module ActionController 36 38 class Base plugins/simply_helpful/lib/simply_helpful/polymorphic_routes.rb
r6098 r6102 24 24 end 25 25 26 def edit_polymorphic_url(record_or_hash, url_writer) 27 polymorphic_url(record_or_hash, url_writer, :action => "edit") 26 %w( edit new formatted ).each do |action| 27 module_eval <<-EOT 28 def #{action}_polymorphic_url(record_or_hash, url_writer) 29 polymorphic_url(record_or_hash, url_writer, :action => "#{action}") 30 end 31 32 def #{action}_polymorphic_path(record_or_hash, url_writer) 33 polymorphic_url(record_or_hash, url_writer, :action => "#{action}", :routing_type => :path) 34 end 35 EOT 28 36 end 29 37 30 def edit_polymorphic_path(record_or_hash, url_writer)31 polymorphic_url(record_or_hash, url_writer, :action => "edit", :routing_type => :path)32 end33 38 34 def new_polymorphic_url(record_or_hash, url_writer)35 polymorphic_url(record_or_hash, url_writer, :action => "new")36 end37 38 def new_polymorphic_path(record_or_hash, url_writer)39 polymorphic_url(record_or_hash, url_writer, :action => "new", :routing_type => :path)40 end41 42 43 39 private 44 40 def action_prefix(options)