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
/Users/texel/Documents/git/quippo/vendor/rails/activesupport/lib/active_support/buffered_logger.rb:99:in `write': closed stream (IOError) | |
from /Users/texel/Documents/git/quippo/vendor/rails/activesupport/lib/active_support/buffered_logger.rb:99:in `flush' | |
from /Users/texel/Documents/git/quippo/vendor/rails/activesupport/lib/active_support/buffered_logger.rb:96:in `synchronize' | |
from /Users/texel/Documents/git/quippo/vendor/rails/activesupport/lib/active_support/buffered_logger.rb:96:in `flush' | |
from /Users/texel/Documents/git/quippo/vendor/rails/activesupport/lib/active_support/buffered_logger.rb:116:in `auto_flush' | |
from /Users/texel/Documents/git/quippo/vendor/rails/activesupport/lib/active_support/buffered_logger.rb:65:in `add' | |
from /Users/texel/Documents/git/quippo/vendor/rails/activesupport/lib/active_support/buffered_logger.rb:71:in `debug' | |
from /Users/texel/Documents/git/quippo/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:189:in `log_info' | |
from /Users/texel/D |
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
# RSpec | |
expect { do_something }.to change { something.else }.from(nil).to(an_instance_of(FooClass)) | |
# Mocha | |
expect { do_something }.to change { something.else }.from(nil).to(instance_of?(FooClass)) |
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
CalendarEvent < ActiveRecord::Base | |
include TimeAttributeExtensions | |
... |
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 TimeAttributeExtensions | |
module ClassMethods | |
def define_attribute_methods | |
if super | |
columns_hash.each do |name, column| | |
if [:datetime, :timestamp].include?(column.type) | |
define_method("#{name}=") do |time| | |
super parse_time_from_hash(time) | |
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
ActiveRecord::Base.send(:include, TimeAttributeExtensions) |
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
ActiveRecord::Base.send(:include, TimeAttributeExtensions) |
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 TimeAttributeExtensions | |
module ClassMethods | |
def define_attribute_methods_with_time_parsing | |
if define_attribute_methods_without_time_parsing | |
columns_hash.each do |name, column| | |
if [:datetime, :timestamp].include?(column.type) | |
unless method_defined?(:"#{name}_without_time_parsing=") |
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 start_time_with_hash_parsing=(new_time) | |
new_time = parse_time_from_hash(new_time) | |
start_time_without_hash_parsing = new_time | |
end | |
alias_method_chain :start_time=, :hash_parsing |
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
CalendarEvent < ActiveRecord::Base | |
... | |
def start_time=(new_time) | |
self[:start_time] = parse_time_from_hash(new_time) | |
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
>> CalendarEvent.new(\ | |
:start_time => {:date => '6/23/2009', :time => '12:30', :meridian => 'pm'}) | |
=> #<CalendarEvent start_time: "2009-06-23 19:30:00"> |