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 show_flash(level = :notice) | |
unless flash[level].nil? | |
html = <<-EOT | |
<blockquote id="flash-#{level.to_s}" class="#{level.to_s}"> | |
<p>#{flash[level]}</p> | |
</blockquote> | |
EOT | |
unless level == :error | |
html << update_page_tag do |page| |
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 after_initialize | |
if new_record? | |
Mergeinfo.columns.select {|c| (! c.null) && (c.name != Mergeinfo.primary_key)}.each do |c| | |
default_value = case c.type | |
when :integer | |
0 | |
when :string | |
'' | |
when :boolean | |
false |
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
#The following assumes an object named "obj" with an action named "meth" that you want to execute at a certain time. | |
#It is assumed that 'obj' has some notion of what weekday and time (hours and minutes) it needs to be executed. | |
#For the purposes of this example, it will be attached directly to obj., but could just as easily come from some associated object. | |
desc "This task is called by the Heroku cron add-on" | |
task :cron => :environment do | |
current_time = Time.now | |
if obj.day == current_time.wday && obj.hour == current_time.hour | |
sleep(obj.min * 60) | |
obj.meth | |
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
$ LDFLAGS='-L/usr/local/opt/openssl/lib' CPPFLAGS='-I/usr/local/opt/openssl/include' PKG_CONFIG_PATH='/usr/local/opt/openssl/lib/pkgconfig' rvm reinstall --with-openssl-dir=/usr/local/Cellar/openssl/1.0.2j ree-1.8.7-2012.02 | |
ree-1.8.7-2012.02 - #removing src/ree-1.8.7-2012.02...... | |
ree-1.8.7-2012.02 - #removing rubies/ree-1.8.7-2012.02...... | |
Installing Ruby Enterprise Edition from source to: /Users/gamblew/.rvm/rubies/ree-1.8.7-2012.02 | |
ree-1.8.7-2012.02 - #fetching (ruby-enterprise-1.8.7-2012.02) | |
ree-1.8.7-2012.02 - #extracting ruby-enterprise-1.8.7-2012.02 to /Users/gamblew/.rvm/src/ree-1.8.7-2012.02................. | |
Checking requirements for osx. | |
Missing required packages: [email protected] | |
Somehow it happened there is no executable 'openssl', | |
run 'brew doctor' and make sure latest '[email protected]' is installed properly. |