Class: VanitiesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
lib/generators/vanities/templates/vanities_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/generators/vanities/templates/vanities_controller.rb', line 3

def show
  # Note that in this case, any model using the vanities system
  # MUST be set up via REST.

  if(v = Vanity.find_by_name(params[:vname]))
    redirect_to v.vain
  else
    # If the vanity name can't be found, render a 404
    respond_to do |f|
      f.html { render :status => :not_found, :file => File.join(Rails.root, "public", "404.html") }
      f.xml  { head :not_found }
      f.any  { head :not_found }
    end
  end    
end