if foo then 'bar' else 'baz'
// Generated by CoffeeScript 1.3.3
if (foo) {
'bar';
} else {
'baz';
if foo then 'bar' else 'baz'
// Generated by CoffeeScript 1.3.3
if (foo) {
'bar';
} else {
'baz';
module Foo | |
def say(text) | |
puts "Foo::say #{text}" | |
end | |
end | |
class Craig | |
include Foo | |
def say(text) | |
super |
The class below has a Paperclip attachment that is stored on S3. The attachment has a custom processor that takes dimensions and crops the image from user defined points. There is a need to move this post-processed attachment from one contact to another, and the copy_avatar_to
methods accomplishes this without reprocessing the attachment. Reprocessing would result in the cropping points being lost, and the original image source being copied over, and resized according to the styles.
# avatar_content_type :string(255)
# avatar_file_name :string(255)
# avatar_file_size :integer
class Foo | |
end | |
def test_class(foo) | |
case foo.class | |
when Foo | |
puts "foo" | |
else | |
puts "other" | |
end |
class Foo < ActiveRecord::Base | |
def self.foo | |
where("1=1") | |
end | |
def self.bar | |
where("2=2") | |
end | |
end |
# == Schema Information | |
# bar :integer | |
class Foo < ActiveRecord::Base | |
validates_uniqueness_of :bar | |
end | |
a=Foo.new(bar: 1) | |
a.valid? # => true | |
b=Foo.new(bar: 1) |
// models/player.js | |
var mongoose = require('mongoose'), | |
Schema = mongoose.Schema; | |
var Player= new Schema({ | |
name: String | |
}); | |
Player.statics = { | |
foo: function() { |
// models/player.js | |
var Player = { | |
statics: { | |
foo: function() { | |
console.log('foo'); | |
} | |
}, | |
methods: { | |
bar: function() { |
I have a Ruby model that needs to have a configuration option passed to it
i.e. config/initializers/contact_import.rb
define options so that:
ContactImport.import_mapping # => {'csv' => ..., 'csv_row' => ..., etc}
Works in production environment, but not in development since classes reload