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
rails _3.2.11_ new rails32_app |
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 --pattern "spec/**/*[RESOURCE]*_spec.rb,spec/**/[RESOURCE]/**/*_spec.rb" --format "documentation" |
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
git reset --hard origin/BRANCH |
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
script: | |
- "xmllint --noout --schema db/schemas/blog_import.xsd db/schemas/sample/*" |
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
class CreatableModel < ActiveRecord::Base | |
after_initialize :readonly!, unless: :new_record? | |
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
gem list | grep -v 'test-unit' | egrep -v 'rdoc|test-unit|psych|io-console|bigdecimal|json|rake|minitest' | xargs gem uninstall |
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
class Float | |
# Public: Round a decimal number using the Swedish rounding system. | |
# | |
# This method complements Float#round but is intended for dealing with | |
# currencies, etc. where a more 'real-life' rounding technique is needed. | |
# | |
# Basically, the vanilla Float#round method only looks at the first number, | |
# which can lead to bad rounds. | |
# | |
# Example |
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
describe Model do | |
it "validates presence of name" do | |
build(:model, name: "").should have(1).errors_on(:name) | |
end | |
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
class Asset < ActiveRecord::Base | |
validates :attachment_content_type, | |
presence: true | |
validates :attachment_file_size, | |
numericality: {only_integer: true} | |
mount_uploader :attachment, AssetUploader | |
before_validation :update_attachment_attributes |
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
version :avatar_large do | |
process resize_to_fill: [940, 309] | |
end | |
version :avatar_large_2x do | |
process resize_to_fill: [940, 309].map { |d| d * 2 } | |
def full_filename(for_file = model.attachment.file) | |
"avatar_large@2x.#{model.attachment.file.extension}" | |
end |