$ rails g model User
belongs_to
has_one
//Different databases. | |
use destination; | |
var dest = db; | |
use source; | |
function copy(doc) { | |
dest.collection.insert(doc); | |
} | |
db.collection.find().forEach(copy); |
source 'https://rubygems.org' | |
gem 'rails', '4.2.5.1' | |
gem 'sqlite3' | |
gem 'sass-rails', '~> 5.0' | |
gem 'uglifier', '>= 1.3.0' | |
gem 'coffee-rails', '~> 4.1.0' | |
gem 'jquery-rails' | |
gem 'turbolinks' | |
gem 'jbuilder', '~> 2.0' | |
gem 'sdoc', '~> 0.4.0', group: :doc |
The MIT License (MIT) | |
Copyright (c) 2015 Justin Perry | |
Permission is hereby granted, free of charge, to any person obtaining a copy of | |
this software and associated documentation files (the "Software"), to deal in | |
the Software without restriction, including without limitation the rights to | |
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | |
the Software, and to permit persons to whom the Software is furnished to do so, | |
subject to the following conditions: |
yum --enablerepo=rpmforge,epel,remi -y install gcc make zlib zlib-devel openssl-devel zsh git | |
cd /usr/local | |
git clone git://github.com/sstephenson/rbenv.git rbenv | |
mkdir rbenv/shims rbenv/versions | |
chgrp -R groupname rbenv | |
chmod -R g+rwxXs rbenv | |
git clone git://github.com/sstephenson/ruby-build.git ruby-build | |
cd ruby-build | |
./install.sh |
apt-get update | |
apt-get install build-essential git zlib1g-dev openssl libopenssl-ruby1.9.1 libssl-dev libruby1.9.1 libreadline-dev libcurl4-gnutls-dev librtmp-dev curl -y | |
apt-get install install postgresql-9.1 libpq-dev zsh -y | |
curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh | |
zsh | |
chsh -s /bin/zsh # This will set zsh as you default shell | |
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile | |
echo 'eval "$(rbenv init -)"' >> ~/.profile | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc |
scp user@host:foreign-file destionation-file |
##Add this gem to your rails app | |
##gem 'rspec-rails' | |
##That allow you to use 'rails g rspec:isntall' | |
gem install rspec | |
rspec --init | |
rails g rspec:install | |
rspec --color --format documentation spec/name_spec.rb |
describe Zombie do | |
it 'gains 3 IQ points by eating brains' do | |
zombie = Zombie.new | |
zombie.iq.should == 0 | |
expect { zombie.eat_brains }.to change { zombie.iq }.by(3) | |
end | |
end |
db.posts.update({ | |
_id : ObjectId("5346e2072ac437a08f93b74c") | |
}, { | |
$inc : { | |
likes : 1 | |
}, | |
$push : { | |
users : 'singleUser' | |
} | |
}); |