This file contains 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
class Post < ActiveRecord::Base | |
belongs_to :post | |
has_many :replies, :class_name => "Post" | |
validates_length_of :title, :maximum => 32, :allow_nil => false, :allow_blank => false, :too_short => "Please, enter a title.", :too_long => "Title is too long. Enter a shorter title." | |
validates_length_of :text, :maximum => 10240, :allow_nil => false, :allow_blank => false, :too_short => "Please, enter a text", :too_long => "Text is too long. Enter a shorter text." | |
end |
This file contains 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
test "There's response" do | |
postCelso = Post.create(:author => "Celso", :title => "Better way to cook eggs", :text => "Does it make any differente to cook the eggs in a microwave oven rather than in a conventional one?") | |
postCelso.save | |
post = Post.create(:title => "WTF?", :text => "Do you cook your eggs in an oven?") | |
post.replies << postCelso | |
assert post.replies[0] == postCelso | |
end |
This file contains 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
class CreatePosts < ActiveRecord::Migration | |
def self.up | |
create_table :posts do |t| | |
t.string :author | |
t.string :title | |
t.string :text | |
t.timestamps | |
end | |
end |
This file contains 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
1) Error: | |
test_There's_response(PostTest): | |
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: posts.post_id: SELECT * FROM "posts" WHERE ("posts".post_id = 2) |
This file contains 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
✗ rake routes | |
Prefix Verb URI Pattern Controller#Action | |
consultas GET /consultas(.:format) consultas#index | |
POST /consultas(.:format) consultas#create | |
new_consulta GET /consultas/new(.:format) consultas#new | |
edit_consulta GET /consultas/:id/edit(.:format) consultas#edit | |
consulta GET /consultas/:id(.:format) consultas#show | |
PATCH /consultas/:id(.:format) consultas#update | |
PUT /consultas/:id(.:format) consultas#update | |
DELETE /consultas/:id(.:format) consultas#destroy |
This file contains 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
def nome=(val) | |
@nome = val | |
@nome_pesquisavel = I18n.transliterate val | |
end |
This file contains 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
=> Booting WEBrick | |
=> Rails 4.0.3 application starting in development on http://0.0.0.0:9999 | |
=> Run `rails server -h` for more startup options | |
=> Ctrl-C to shutdown server | |
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message. | |
[2014-04-08 13:58:26] INFO WEBrick 1.3.1 | |
[2014-04-08 13:58:26] INFO ruby 2.0.0 (2013-06-27) [x86_64-linux] | |
[2014-04-08 13:58:26] INFO WEBrick::HTTPServer#start: pid=30405 port=9999 | |
This file contains 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
Arquivo binário app/assets/images/fundo_header.png coincide com o padrão | |
Gemfile: gem "pg" | |
Gemfile.lock: pg (0.17.1) | |
Gemfile.lock: pg | |
Arquivo binário prototipo/css/img_css_config/fundo_header.png coincide com o padrão | |
script.sh:echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee -a /etc/apt/sources.list |
This file contains 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
development: | |
adapter: sqlite3 | |
database: dev_db.sqlite3 | |
pool: 5 | |
timeout: 5000 | |
# Warning: The database defined as "test" will be erased and | |
# re-generated from your development database when you run "rake". | |
# Do not set this db to the same as development or production. | |
test: |
This file contains 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
--- | |
layout: default | |
page_type: "category" | |
posts: site.categories.jekyll | |
--- | |
{% include post_list.html posts=page.posts %} |
OlderNewer