Changeset 1221
- Timestamp:
- 07/22/08 20:27:21 (6 months ago)
- Files:
-
- trunk/app/controllers/public_controller.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/app/controllers/public_controller.rb
r1211 r1221 7 7 8 8 def welcome 9 @episodes_last = Episode.find(:all, :order => "created_at DESC", :limit => 10) 9 if @show.blank? 10 if request.host =~ /((www.)bonnes-ondes.fr|localhost)/ 11 @episodes_last = Episode.find(:all, :order => "created_at DESC", :limit => 10) 12 else 13 raise ActiveRecord::RecordNotFound 14 end 15 else 16 render_show 17 end 10 18 end 11 19 12 20 def show 13 create_visit @show 14 render :layout => "public_render" 21 render_show 15 22 end 16 23 … … 36 43 private 37 44 38 def assigns_show 39 @show = find_show unless params[:show_slug].blank? 45 def render_show 46 create_visit @show 47 render :layout => "public_render", :action => :show 40 48 end 41 49 42 def find_show 43 return @show unless @show.blank? 50 def assigns_show 51 host = Host.find_by_name(request.host) 52 unless host.blank? 53 @show = host.show 54 end 44 55 45 show = Show.find_by_slug(params[:show_slug]) 46 raise ActiveRecord::RecordNotFound if show.nil? 47 show 56 show_slug = "" 57 if request.host =~ /^(.*).bonnes-ondes.fr$/ 58 show_slug = $1 59 end 60 61 @show = find_show(show_slug) 62 end 63 64 def find_show(slug = nil) 65 @show ||= Show.find_by_slug(slug) 48 66 end 49 67
