application_controller.rb 1.2 KB
Newer Older
J
Justin Collins 已提交
1 2 3 4 5 6 7 8 9
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  helper :all # include all helpers, all the time
  #protect_from_forgery # See ActionController::RequestForgeryProtection for details

  # Scrub sensitive parameters from your log
  # filter_parameter_logging :password
J
Justin Collins 已提交
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
  before_filter :awesome

  def funky_panda
  end

  def awesome
    something = if params[:thang]
                  params[:thang]
                elsif somevar = "monkeypanda"
                  somevar = somevar.split(",").map { |s|
                    s += 'stuff' unless s =~ /regex/
                      s.split('things')
                  }.first
                  somevar.first.downcase
                end

    if (some_var = SomeClass.things, something)
      AnotherClass.thang = @thang = some_var.to_sym
    elsif (some_var = find_thang(AppConfig.stuff, something))
      AnotherClass.thang = @thang = some_var.to_sym
    end

    if beta_override && cookies['yummy'] != @thang.to_s
      cookies['yummy'] = { :value => @thang.to_s }
    end

    return true
  end
J
Justin Collins 已提交
38
end