Skip to content

Instantly share code, notes, and snippets.

View kent's full-sized avatar
👋

Kent Fenwick kent

👋
View GitHub Profile
#
# Cookbook Name:: delayed_job
# Recipe:: default
#
if %w(solo app app_master).include?(node[:instance_role])
user = node[:owner_name]
framework_env = node[:environment][:framework_env]
# Be sure to replace APP_NAME with the name of your application.
# include this in application controller
module Authentication
protected
# Inclusion hook to make #current_user and #signed_in?
# available as ActionView helper methods.
def self.included(base)
base.send :helper_method, :current_user, :signed_in?, :authorized? if base.respond_to? :helper_method
end
# Returns true or false if the user is signed in.
module EasySelectFields
def easy_select_fields(a,options)
type_method_name = "#{a}_types".to_sym
array = options.each_with_index.map {|o,i| [o, i += 1] }
class_eval "def self.#{a}_types() #{array.inspect} end"
end
end
class Person