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
#!/usr/bin/env ruby | |
# Let's just worry about what's done to Array directly, and not the insanity | |
# in any of the parent classes. | |
$existing_methods = [] | |
def print_methods(library) | |
new_methods = ([].methods.sort - [].class.superclass.methods.sort) - $existing_methods | |
for method in new_methods |
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
task :cruise do | |
execute_tasks %W(configure_cruise gems:unpack gems:build db:migrate) | |
trace = ARGV.include?("--trace") ? '--trace' : '' | |
puts %x[rake RAILS_ENV=cucumber db:migrate #{trace}].strip | |
execute_tasks %W(spec features) | |
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
# This playing about lead to the following plugin: | |
# http://github.com/craigw/callback_after_commit/tree/master | |
# use that instead. | |
module TransactionCommitCallback | |
def self.included(base) | |
base.send(:alias_method, :transaction_without_callbacks, | |
:transaction) | |
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
Then I should see the thumbnail "ponies.png" |
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
if @widget.save | |
flash[:info] = "Your widget has been saved." | |
flash[:notice] = "There are now #{Widget.count} widgets." | |
redirect_to @widget and return | |
else | |
flash.now[:warning] = "I couldn't save your widget." | |
render :action => "edit" | |
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
<%= flash.sort.collect do |level, message| | |
content_tag(:p, message, :class => "flash #{level}", :id => "flash_#{level}") | |
end.join %> |
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
<p class="flash info" id="flash_info">Your widget has been saved.</p> | |
<p class="flash notice" id="flash_notice">There are now 29 widgets.</p> |
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
Time.now | |
Monkey.find(:all) |
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
@widget.to_s | |
Time.now.to_f |
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
chicken = Chicken.new | |
class << chicken | |
def hide | |
# ... | |
end | |
end | |
chicken.hide |
OlderNewer