Changeset 5700
- Timestamp:
- 12/07/06 02:37:33 (2 years ago)
- Files:
-
- plugins/simply_helpful/lib/simply_helpful/controller_extensions.rb (modified) (2 diffs)
- plugins/simply_helpful/lib/simply_helpful/form_helper_extensions.rb (modified) (1 diff)
- plugins/simply_helpful/lib/simply_helpful/record_identifier.rb (modified) (1 diff)
- plugins/simply_helpful/lib/simply_helpful/record_tag_helper.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/simply_helpful/lib/simply_helpful/controller_extensions.rb
r5609 r5700 1 1 module SimplyHelpful 2 2 module ActionControllerExtensions 3 def self.included(base) 4 base.helper_method :polymorphic_url 5 base.helper_method :polymorphic_path 6 end 7 8 def polymorphic_url(record) 9 SimplyHelpful::RecordIdentifier.polymorphic_url(record, self) 10 end 11 12 def polymorphic_path(record) 13 SimplyHelpful::RecordIdentifier.polymorphic_path(record, self) 14 end 15 3 16 def redirect_to_with_record_identification(*args) 4 17 return redirect_to_without_record_identification *args unless args.size == 1 … … 10 23 redirect_to_without_record_identification *args 11 24 else 12 redirect_to_without_record_identification SimplyHelpful::RecordIdentifier. named_route(potential_object, self)25 redirect_to_without_record_identification SimplyHelpful::RecordIdentifier.polymorphic_url(potential_object, self) 13 26 end 14 27 end plugins/simply_helpful/lib/simply_helpful/form_helper_extensions.rb
r5168 r5700 19 19 object_name = SimplyHelpful::RecordIdentifier.singular_class_name(name_or_object) 20 20 object = name_or_object 21 url = SimplyHelpful::RecordIdentifier. named_route(object, self)21 url = SimplyHelpful::RecordIdentifier.polymorphic_url(object, self) 22 22 23 23 html_options = if object.new_record? plugins/simply_helpful/lib/simply_helpful/record_identifier.rb
r5168 r5700 3 3 extend self 4 4 5 def named_route(record, url_writer)5 def polymorphic_url(record, url_writer) 6 6 record.new_record? ? 7 7 url_writer.send(plural_class_name(record) + "_url") : 8 8 url_writer.send(singular_class_name(record) + "_url", record) 9 end 10 11 def polymorphic_path(record, url_writer) 12 record.new_record? ? 13 url_writer.send(plural_class_name(record) + "_path") : 14 url_writer.send(singular_class_name(record) + "_path", record) 9 15 end 10 16 plugins/simply_helpful/lib/simply_helpful/record_tag_helper.rb
r5308 r5700 65 65 link_to_without_record_identification(attr_name, record, html_options, *parameters_for_method_reference) 66 66 else 67 url = SimplyHelpful::RecordIdentifier. named_route(record, self)67 url = SimplyHelpful::RecordIdentifier.polymorphic_url(record, self) 68 68 link_text = record.respond_to?(attr_name) ? record.send(attr_name) : attr_name 69 69 link_to_without_record_identification(link_text, url, html_options, *parameters_for_method_reference)