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
# Output information | |
watch('config/routes.rb') { system("clear; rake routes")} | |
# Run migrations | |
# watch('^db/migrate/(.*)\.rb') { |m| check_migration(m[1]) } | |
# # Run SASS | |
# watch('^app/stylesheets/(.*\.sass)') { |m| check_sass(m[1]) } | |
# # Run specific tests |
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 find_shipping_country_state(state_name) | |
shipping_address.try(:country).try(:find_state_by_name, state_name) | |
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 = Car.new | |
c.try(:push) | |
# -> NoMethodError: undefined method `push' for #<Car > |
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 NilClass | |
def try(*args) | |
nil | |
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
def try(method, *args, &block) | |
send(method, *args, &block) | |
end | |
remove_method :try | |
alias_method :try, :__send__ |
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 shipping_country_name | |
shipping_address.try(:country).try(:name) | |
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
def shipping_country_name | |
shipping_address && shipping_address.country && shipping_address.country.name | |
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
def shipping_country_name | |
shipping_address.country.name | |
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
$.extend(true, views, { rooms: { | |
tooltip: function(name) { | |
return "<div class='room' id='room_"+(Room.count() + 1)+"'>\ | |
<p>"+name+"</p>\ | |
</div>"; | |
} | |
}}); |
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
$.extend(Room.prototype, { | |
roomText: function () { | |
return this.element.find("p").text(); | |
}, | |
next: function () { | |
return this.element.next(); | |
}; | |
}); |