Radio, Web and Free Software

Changeset c5037a4ce54f151978b2a29e61f78dde36d3cbea

Show
Ignore:
Timestamp:
07/27/10 09:10:14 (6 weeks ago)
Author:
Alban Peignier <alban@…>
Parents:
cb93cb8c2391bcfdff4eefed378aa47f6a8ef266
Children:
96b960ab28342be2b47c677a1e8a569f8e5cf395
git-committer:
Alban Peignier <alban@tryphon.eu> / 2010-07-27T09:10:14Z+0200
Message:

Optimise db usage for PublicController#robots?

Location:
app
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • app/controllers/public_controller.rb

    rcb93cb8 rc5037a4  
    77  append_view_path "#{Rails.root}/templates" 
    88 
    9   before_filter :assigns_show, :create_user_google_analytics_account, :except => :feed 
     9  before_filter :assigns_show, :create_user_google_analytics_account, :except => [:feed, :robots] 
    1010  before_filter :assigns_now 
    1111 
     
    3636 
    3737  def feed 
    38     current_show [{:episodes => [ :show, { :contents => { :episode => [ :contents, :tags, { :show => :host } ] } }, :tags ]}, :host]  
     38    load_show [{:episodes => [ :show, { :contents => { :episode => [ :contents, :tags, { :show => :host } ] } }, :tags ]}, :host]  
    3939    render :content_type => "application/rss+xml", :layout => false 
    4040  end 
     
    5454 
    5555  def robots 
     56    load_show [{:episodes => {:show => :host }}, {:contents => {:episode => {:show => :host}} }] 
    5657    respond_to do |format| 
    5758          format.txt { render :layout => false } 
  • app/models/show.rb

    r439b576 rc5037a4  
    2525  has_and_belongs_to_many :users 
    2626  has_many :episodes, :dependent => :destroy, :order => "`order` desc" 
     27  has_many :contents, :through => :episodes 
    2728  has_many :images, :dependent => :destroy 
    2829  has_many :posts, :dependent => :destroy, :order => "`created_at` desc" 
  • app/views/public/robots.txt.erb

    r57cce5e rc5037a4  
    22 
    33User-agent: * 
    4 <%- for content in @show.episodes.collect(&:contents).flatten -%> 
     4<%- for content in @show.contents -%> 
    55Disallow: <%= url_for_content(content, :only_path => true) %> 
    66<%- end -%>