Command Line
pry -r ./config/app_init_file.rb
- load your app into a pry session (look at the file loaded by config.ru)pry -r ./config/environment.rb
- load your rails into a pry session
Debugger
ALPHABET_SIZE = 26 | |
def caesar_cipher(string) | |
shiftyArray = [] | |
charLine = string.chars.map(&:ord) | |
shift = 1 | |
ALPHABET_SIZE.times do |shift| | |
shiftyArray << charLine.map do |c| | |
((c + shift) < 123 ? (c + shift) : (c + shift) - 26).chr |
class API::V1::BaseController < ApplicationController | |
skip_before_filter :verify_authenticity_token | |
before_filter :cors_preflight_check | |
after_filter :cors_set_access_control_headers | |
def cors_set_access_control_headers | |
headers['Access-Control-Allow-Origin'] = '*' | |
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS' |
Command Line
pry -r ./config/app_init_file.rb
- load your app into a pry session (look at the file loaded by config.ru)pry -r ./config/environment.rb
- load your rails into a pry sessionDebugger
#!/bin/bash | |
# | |
# Script para deploy de Rails 3.2.17 | |
# nos servidores compartilhados da Kinghost | |
# Desenvolvido por Gustavo Kuklinski (@tuxlinski) | |
# http://www.kuklinski.com.br | |
# | |
# Até o momento o Script apenas funciona caso você tenha mais de UMA aplicação | |
# criada pelo painel de controle! |
#!/usr/bin/env python | |
import os | |
import time | |
username = 'root' | |
defaultdb = 'postgres' | |
port = '5433' | |
backupdir='/www/backup/' | |
date = time.strftime('%Y-%m-%d') |
In this article, I'll walk through a basic Rails (3.2.x) setup for creating a nested resource for two models. Nested resources work well when you want to build out URL structure between two related models, and still maintain a RESTful convention. This code assumes you are running RVM to manage Ruby/Gem versions, and Git for version control.
$ mkdir family # create rvm gemset
$ echo "rvm use --create ruby-1.9.2@family" > family/.rvmrc
$ cd family # install rails
$ gem install rails # create new rails project
$ rails new . # version control
require 'spec_helper' | |
describe "Artists to releases relationship" do | |
before(:all) do | |
@kanye = FactoryGirl.create(:artist, :name => 'Kanye West') | |
@jz = FactoryGirl.create(:artist, :name => 'Jay Z') | |
@watch_the_throne = FactoryGirl.create(:release, :name => 'Watch the Throne') | |
@dropout = FactoryGirl.create(:release, :name => 'The College Dropout') | |
end |
# encoding: UTF-8 | |
# pt-BR translations for Devise | |
pt-BR: | |
devise: | |
confirmations: | |
confirmed: "Sua conta foi confirmada com sucesso. Você está logado." | |
send_instructions: "Dentro de minutos, você receberá um e-mail com instruções para a confirmação da sua conta." | |
send_paranoid_instructions: "Se o seu endereço de e-mail estiver cadastrado, você receberá uma mensagem com instruções para confirmação da sua conta." | |
failure: | |
already_authenticated: "Você já está logado." |
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |