Skip to content

Instantly share code, notes, and snippets.

#this fails
lambda { User.create }.should change(User.all, :count).by(+1)
#this passes
lambda { User.create }.should change(User, :count).by(+1)
class Repository
include MongoMapper::Document
key :follower_ids, Array
many :followers, :class_name => 'User', :in => :follower_ids
end
repository = Repository.first
repository.followers # <== Association proxy to the users that follow this repository.
set :application, "ignitious"
set :repository, "git@github.com:ethangunderson/ignitious.git"
set :ssh_flags, "-p 12345"
task :stage do
set :deploy_to, "/var/apps/#{application}-stage"
set :domain, "deploy@ignitious.com"
end
task :production do
<script type='text/javascript'>
//<![CDATA[
alert('Whoa! This is Javascript!');
//]]>
</script>
:javascript
alert('Whoa! This is Javascript!');
-@posts.each do |post|
%span.title= post.title
.post= post.content
%span.author= post.author
<% @posts.each do |post| %>
<span class='title'><%= post.title %></span>
<div class='post'><%= post.content %></div>
<span class='author'><%= post.author %></span>
<% end %>
!!!
%html
%head
%title Look, we're using Haml!
%body
#content
.post#first
!!!
%html
%head
%title Look, we're using Haml!
%body
%.div#content
%div.post#first
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Look, we're using Haml!</title>
<body>
<div id='content'>
<div class='post' id='first'></div>
</div>
</body>
</head>