This file contains 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 LocationsHelper | |
def self.detailed_information(location) | |
detailed_information =[ ["Accepts credit cards?", location.accepts_credit_cards] ] | |
unless location.smoking_policy.nil? | |
detailed_information << [ "Smoking Policy", location.smoking_policy] | |
end | |
unless location.center.nil? | |
detailed_information << ["Center" , location.center.name, center_path(location.center.id)] | |
end | |
This file contains 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 ActiveRecord | |
class Base | |
def self.random | |
if (c = count) != 0 | |
find(:first, :offset =>rand(c)) | |
end | |
end | |
end | |
end |
This file contains 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 SessionsHelper | |
def deny_access | |
#store_location | |
notice = current_user.nil?? "Please sign in to access this page" : "You must sign in as an admin to access this page" | |
#flash[:error] = notice | |
logger.debug "here" | |
logger.debug notice | |
#flash[:notice] = notice | |
logger.debug flash[:notice] |
This file contains 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
def self.deflate(string) | |
zstream = Zlib::Deflate.new | |
buf = zstream.deflate(string) | |
zstream.finish | |
zstream.close | |
buf | |
end |
This file contains 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
include LocationsHelper | |
include SessionsHelper | |
class LocationsController < ApplicationController | |
before_filter :admin_user, :only => [:new, :create, :edit, :destroy] | |
def new | |
end | |
def create |
This file contains 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 AuthsController < ApplicationController | |
include AuthsHelper | |
def helloauth | |
flash[:error] = session[:hello] | |
redirect_to root_path | |
end | |
end |
This file contains 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
c:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-mount-0.6.13/lib/rack/mount/strexp.rb:4 | |
1: warning: redundant nested repeat operator | |
c:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.5/lib/action_dispatch/routing | |
/route.rb:25: warning: redundant nested repeat operator | |
c:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-mount-0.6.13/lib/rack/mount/route.rb:46 | |
: warning: redundant nested repeat operator |
This file contains 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 ActiveRecord | |
class Base | |
def fill(hash, ignore =[]) | |
b = self.getBinding | |
hash.each do |k,v| | |
if !ignore.include?(k) | |
#send(k + "=", v) | |
eval("#{k} = #{v}", b) | |
end |
This file contains 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 OperationInterval < ActiveRecord::Base | |
include OperationIntervalsHelper | |
before_save :fix_values | |
before_update :fix_values | |
AMPM = [ "am", "pm" ] | |
HOURS = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" ] | |
MINUTES = ["00", "15", "30", "45"] | |
DAYS = ["M", "T", "W", "Th", "F", "S", "Su"] |
This file contains 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
irb(main):010:0> x | |
=> {"start_day"=>"M", "end_day"=>"F", "f_start_hour"=>"8", "start_minute"=>"00", | |
"start_ampm"=>"am", "f_end_hour"=>"7", "end_minute"=>"00", "end_ampm"=>"pm", "o | |
ld_record"=>"18"} | |
irb(main):011:0> temp = OperationInterval.find(18) | |
=> #<OperationInterval id: 18, days: nil, start_hour: nil, start_minute: 0, end_ | |
hour: nil, end_minute: 0, closed: nil, created_at: "2011-04-14 09:28:21", update | |
d_at: "2011-04-14 09:28:21"> | |
irb(main):012:0> temp.attributes= x | |
=> {"start_day"=>"M", "end_day"=>"F", "f_start_hour"=>"8", "start_minute"=>"00", |
OlderNewer