Skip to content

Instantly share code, notes, and snippets.

View sandsu's full-sized avatar

Sanderson Santana sandsu

View GitHub Profile
@campaign = Campaign.new
10.times do
q = Question.new
5.times do
q.default_answers.build
end
@campaign.questions<<q
end
simple_form_for @campaign do |f|
f.simple_fields_for :questions do |q|
f.simple_fields_for :answer do %>
end
end
end
@sandsu
sandsu / nginx
Created July 13, 2012 17:40 — forked from continuityapp/nginx
Ubuntu 10.04 LTS Nginx startup script
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
{
"Some group name": {
"First store": {
image: "URL_DA_IMAGEM",
goal: 30000000,
value: 27975000,
description: "5 teams",
url: "http://google.com.br"
},
"Second store": {
class Customer < ActiveRecord::Base
def self.find_by_name(query)
where("name LIKE ?", query)
end
end
Failures:
1) Customer find by name
Failure/Error: Customer.find_by_name("Homer Simpson").count.should == 1
expected: 1
got: 0 (using ==)
# ./spec/models/customer_spec.rb:64:in `block (2 levels) in <top (required)>'
def self.find_by_name(query)
where("name @@ :name", name: query)
end
{
"bold_folder_labels": true,
"color_scheme": "Packages/Color Scheme - Default/Tomorrow-Night.tmTheme",
"font_size": 17.0,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
[
"Vintage"
],
// While you can edit this file, it's best to put your changes in
// "User/Preferences.sublime-settings", which overrides the settings in here.
//
// Settings may also be placed in file type specific options files, for
// example, in Packages/Python/Python.sublime-settings for python files.
{
// Sets the colors used within the text area
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
// Note that the font_face and font_size are overriden in the platform
# encoding: utf-8
require 'spec_helper'
describe Comment do
describe "#valid?" do
it "true when user is valid" do
user = User.new(:valid=>true)
Comment.new(:user=>user).should be_valid