This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Application::Controller::Authlogic | |
def self.included(base) | |
base.extend Application::Controller::Authlogic::ClassMethods | |
end | |
module ClassMethods | |
end | |
def current_session(id=nil) | |
if User.session_ids.include?(id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Settings < Settingslogic | |
source "#{Rails.root}/config/application.yml" | |
if Rails.env == 'development' | |
namespace 'development-' + Socket.gethostname.gsub(/\W/, '-').gsub(/[-]{2,}/, '-') | |
else | |
namespace Rails.env | |
end | |
# load local settings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Admin::AdminController < ActionController::Base | |
def self.simple_action(*actions) | |
actions.each {|action| class_eval("def #{action}; end")} | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Time | |
def ceil(seconds = 60) | |
Time.at((self.to_f / seconds).ceil * seconds) | |
end | |
def floor(seconds = 60) | |
Time.at((self.to_f / seconds).floor * seconds) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rainbow' | |
def log(level, message) | |
Rails.logger.send level, message.foreground(color_for_level(level)) | |
if RAILS_ENV == 'development' | |
puts level.to_s.upcase " " message.foreground(color_for_level(level)) | |
end | |
end | |
def color_for_level(level) |
NewerOlder