Code:
new Account({
accountNumber: 123123
}).fetchAll({
withRelated: 'customer'
}).then(function(accounts) {
// accounts has all the elements
});Code:
new Account({
accountNumber: 123123
}).fetchAll({
withRelated: 'customer'
}).then(function(accounts) {
// accounts has all the elements
});var Customer = Bookshelf.Model.extend({
tableName : 'customers',
accounts : function() {
return this.hasMany(Account, 'customerId');
}
});
var Account = Bookshelf.Model.extend({
tableName : 'accounts',I hereby claim:
To claim this, I am signing this object:
| #!/usr/bin/ruby | |
| #-*-ruby-*- | |
| # A script to run takes git shots on every commit. Can be run on | |
| # the current dir, called from a git callback, or install itself as a | |
| # git post-commit callback. | |
| HOOKS = %w{post-commit} | |
| HOOKS_DIR = '.git/hooks' | |
| def ensure_git_repo |
| class PhysicalStorageVolume | |
| OS_VERSION = RbConfig::CONFIG['host_os'] | |
| def initialize(path) | |
| @path = path | |
| @path_exists = File.exists?(path) | |
| end | |
| def self.error_raising_method(name) | |
| define_method(name) do |*args| |
| %s/def test_\(.*\)/it "\1" do | |
| %s/ should / it / | |
| %s/setup do/before(:each) do/ | |
| %s/def setup/before(:each) do/ | |
| %s/assert_true \(.*\)/\1.should be_true/ | |
| %s/assert \(.*\)/\1.should be_true/ | |
| %s/assert_false \(.*\)/\1.should be_false/ | |
| %s/assert_equal(\(.*\),\(.*\))/\2.should == \1/ | |
| %s/assert_equal \(.*\),\(.*\)/\2.should == \1/ | |
| %s/assert_nil \(.*\)/\1.should be_nil/ |
| 1 had submodule 2 | |
| 2 had submodule 3 | |
| 3 had submodule 4 |