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
# config/locales/en.yml | |
en: | |
errors: | |
messages: | |
wrong_size: "is the wrong size (should be %{file_size})" | |
size_too_small: "is too small (should be at least %{file_size})" | |
size_too_big: "is too big (should be at most %{file_size})" |
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
function historySupport() { | |
return !!(window.history && window.history.pushState !== undefined); | |
} | |
function pushPageState(state, title, href) { | |
if (historySupport()) { | |
history.pushState(state, title, href); | |
} | |
} |
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
Factory.define :item do |f| | |
include ActionDispatch::TestProcess | |
f.name "Macbook Pro 15" | |
f.price_in_dollars 1500 | |
f.photo fixture_file_upload('/files/avatar.jpg', 'image/jpg') | |
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 temp_path | |
p = temp_paths.first | |
if p.is_a?(ActionDispatch::Http::UploadedFile) # Rails 3.0.3 compatability fix | |
p.tempfile.path | |
else | |
p.respond_to?(:path) ? p.path : p.to_s | |
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
class FooSweeper < ModelOnlySweeper | |
observe Foo | |
def after_save(object) | |
expire_cache_for(object) | |
end | |
def after_destroy(object) | |
expire_cache_for(object) |
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
Factory.define :application do |factory| | |
factory.attachment(:sample, "public/samples/sample.doc", "application/msword") | |
end |