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 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 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
| ActiveRecord::Base.send(:include, TimeAttributeExtensions) |
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
| ActiveRecord::Base.send(:include, TimeAttributeExtensions) |
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 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 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
| CalendarEvent < ActiveRecord::Base | |
| include TimeAttributeExtensions | |
| ... |
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
| # 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 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
| /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 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
| table_for @discount_codes do |table| | |
| table.column :code | |
| table.column :description | |
| table.column :max_uses, :label => 'Maximum Uses' do |discount_code| | |
| discount_code.max_uses || 'Unlimited' | |
| end | |
| end | |
| # I want to be able to do this: |
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 'autotest/fsevent' | |
| require 'autotest/growl' | |
| Autotest::Growl::remote_notification = true | |
| Autotest.add_hook :initialize do |at| | |
| at.sleep = 1 | |
| %w{.svn .hg .git vendor}.each {|exception| at.add_exception(exception)} | |
| unless ARGV.empty? |
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
| function aspec { | |
| args="" | |
| for var in "$@" | |
| do | |
| args="$args spec/*/$var\_spec.rb app/*/$var.rb app/processors/$var.rb app/models/*/$var.rb spec/*/controls/$var\_spec.rb spec/models/*/$var\_spec.rb app/*/controls/$var.rb lib/$var.rb" | |
| done | |
| echo "Running autospec $args" | |
| autospec $args | |
| } |