This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Gemfile | |
source 'http://rubygems.org' | |
source "http://gems.github.com" | |
gem 'rails', '3.0.6' | |
gem 'pg' | |
$ bundle install | |
Fetching source index for http://rubygems.org/ | |
Fetching source index for http://gems.github.com/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<head> | |
<!-- bem quando eu uso dessa forma meu layout o sinatra da um erro em: @texto.conteudo --> | |
<!-- mas quando eu retiro o @texto.conteudo o codigo de exemplo funciona todo perfeitamente --> | |
<title><%= @texto.conteudo || "My Texts!" %></title> | |
</head> | |
<body> | |
Text:<br /> | |
<%= yield %> | |
</body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra' | |
require 'dm-core' | |
require 'dm-validations' | |
require 'dm-timestamps' | |
# bem na apostila esqueceu de incluir essa gem | |
require 'dm-migrations' | |
# lembrar de informar na apostila a instalação da gem dm-mysql-adapter | |
DataMapper.setup(:default, "mysql://localhost/textos") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>KeepAlive</key> | |
<true/> | |
<key>Label</key> | |
<string>com.mysql.mysqld</string> | |
<key>Program</key> | |
<string>/usr/local/mysql/bin/mysqld_safe</string> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.bash_profile | |
# exports | |
#export PATH="/usr/local:$PATH" | |
export PATH="/usr/local/mysql/bin:$PATH" | |
#export ARCHFLAGS="-arch i386 -arch x86_64" | |
export ARCHFLAGS="-arch x86_64" | |
export GREP_OPTIONS="--color=auto" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~$ cd nome_da_minha_aplicacao | |
~/nome_da_minha_aplicacao$ script/about | |
About your application's environment | |
Ruby version 1.8.7 (i686-linux) | |
RubyGems version 1.3.3 | |
Rails version 2.2.2 | |
Active Record version 2.2.2 | |
Action Pack version 2.2.2 | |
Active Resource version 2.2.2 | |
Action Mailer version 2.2.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~$ rails _2.2.2_ nome_da_minha_aplicacao |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- index --> | |
<%= image_tag @user.avatar.url %> | |
<%= image_tag @user.avatar.url(:small) %> | |
<%= image_tag @user.avatar.url(:large) %> | |
<!-- index --> | |
<!-- show --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- new --> | |
<% @nome_pagina = 'Adicionar User' %> | |
<!-- o multipart é para informar que irá ser feito o carregamento/upload de um arquivo --> | |
<% form_for(@user, :html => { :multipart => true }) do |f| %> | |
<%= render :partial => "user", :locals => { :f => f } %> | |
<%= f.submit "Criar User" %> | |
<% end %> | |
<%= link_to 'Retornar', users_path %> | |
<!-- new --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- partial --> | |
<%= f.error_messages %> | |
<p> | |
<%= f.label :name %><br /> | |
<%= f.text_field :name %> | |
</p> | |
<p> | |
<%= f.label :email %><br /> | |
<%= f.text_field :email %> |