Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 6150

Show
Ignore:
Timestamp:
02/15/07 08:02:57 (2 years ago)
Author:
bitsweat
Message:

Update resource_feeder for simply_helper changing location of simply_helpful's polymorphic_url. Closes #7468.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/resource_feeder/lib/resource_feeder/atom.rb

    r6088 r6150  
     1require 'resource_feeder/common' 
     2 
    13module ResourceFeeder 
    24  module Atom 
     5    include ResourceFeeder::Common 
    36    extend self 
    47     
     
    2326      options[:feed][:title] ||= klass.name.pluralize 
    2427      options[:feed][:id]    ||= "tag:#{request.host_with_port}:#{klass.name.pluralize}" 
    25       options[:feed][:link]  ||= SimplyHelpful::RecordIdentifier.polymorphic_url(new_record, options[:url_writer]) 
     28      options[:feed][:link]  ||= SimplyHelpful::PolymorphicRoutes.polymorphic_url(new_record, options[:url_writer]) 
    2629       
    2730      options[:item][:title]       ||= [ :title, :subject, :headline, :name ] 
     
    3033      options[:item][:author]      ||= [ :author, :creator ] 
    3134       
    32       resource_link = lambda { |r| SimplyHelpful::RecordIdentifier.polymorphic_url(r, options[:url_writer]) } 
     35      resource_link = lambda { |r| SimplyHelpful::PolymorphicRoutes.polymorphic_url(r, options[:url_writer]) } 
    3336 
    3437      xml.instruct! 
     
    6063      end 
    6164    end 
    62      
    63     private 
    64       def call_or_read(procedure_or_attributes, resource) 
    65         case procedure_or_attributes 
    66           when Array 
    67             attributes = procedure_or_attributes 
    68             resource.send(attributes.select { |a| resource.respond_to?(a) }.first) 
    69           when Symbol 
    70             attribute = procedure_or_attributes 
    71             resource.send(attribute) 
    72           when Proc 
    73             procedure = procedure_or_attributes 
    74             procedure.call(resource) 
    75         end 
    76       end 
    7765  end 
    7866end 
  • plugins/resource_feeder/lib/resource_feeder/rss.rb

    r5719 r6150  
     1require 'resource_feeder/common' 
     2 
    13module ResourceFeeder 
    24  module Rss 
     5    include ResourceFeeder::Common 
    36    extend self 
    47 
     
    2326 
    2427      options[:feed][:title]    ||= klass.name.pluralize 
    25       options[:feed][:link]     ||= SimplyHelpful::RecordIdentifier.polymorphic_url(new_record, options[:url_writer]) 
     28      options[:feed][:link]     ||= SimplyHelpful::PolymorphicRoutes.polymorphic_url(new_record, options[:url_writer]) 
    2629      options[:feed][:language] ||= "en-us" 
    2730      options[:feed][:ttl]      ||= "40" 
     
    3134      options[:item][:pub_date]        ||= [ :updated_at, :updated_on, :created_at, :created_on ] 
    3235 
    33       resource_link = lambda { |r| SimplyHelpful::RecordIdentifier.polymorphic_url(r, options[:url_writer]) } 
     36      resource_link = lambda { |r| SimplyHelpful::PolymorphicRoutes.polymorphic_url(r, options[:url_writer]) } 
    3437 
    3538      rss_root_attributes = { :version => 2.0 } 
     
    6164      end 
    6265    end 
    63  
    64     private 
    65       def call_or_read(procedure_or_attributes, resource) 
    66         case procedure_or_attributes 
    67           when Array 
    68             attributes = procedure_or_attributes 
    69             resource.send(attributes.select { |a| resource.respond_to?(a) }.first) 
    70           when Symbol 
    71             attribute = procedure_or_attributes 
    72             resource.send(attribute) 
    73           when Proc 
    74             procedure = procedure_or_attributes 
    75             procedure.call(resource) 
    76         end 
    77       end 
    7866  end 
    7967end