Skip to content

Commit

Permalink
creating posts
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoLnx committed Mar 6, 2011
1 parent eb39ad1 commit 8726137
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -2,3 +2,5 @@
db/*.sqlite3
log/*.log
tmp/
*.swp
*.swo
7 changes: 7 additions & 0 deletions app/controllers/posts_controller.rb
@@ -0,0 +1,7 @@
class PostsController < ApplicationController
def show
id = params[:id]
@post = Post.find id
render Dir["app/views/posts/#{sprintf('%.3d',@post.id)}-*"].first
end
end
2 changes: 2 additions & 0 deletions app/models/post.rb
@@ -0,0 +1,2 @@
class Post < ActiveRecord::Base
end
9 changes: 9 additions & 0 deletions app/views/posts/001-ola_a_todos.html
@@ -0,0 +1,9 @@
Olá, bem vindos ao meu blog, criei ele depois que o <a title="Anderson Leite" href="http://andersonleiteblog.wordpress.com/" target="_blank">anderson leite</a> quase me deu uma surra por eu não ter. xD

Tentarei sempre postar algo que eu esteja fazendo(principalmente de ruby xD), ou notícias que eu ache interessante, ou seja,  tudo que eu estiver sabendo pretendo informar por aqui.=D

Hoje não dará tempo, mas vo ver se logo amanhã posto uma tutorial de como compilar o arquivo .rb(em jruby) para um arquivo .class e roda-lo direto na JVM.xD

Enfim.. Por hoje é isso, espero que gostem do que eu postar aqui.xD

Obrigado e até mais =D
1 change: 1 addition & 0 deletions config/routes.rb
Expand Up @@ -55,4 +55,5 @@
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
resources :posts
end
13 changes: 13 additions & 0 deletions db/migrate/20110306213139_create_posts.rb
@@ -0,0 +1,13 @@
class CreatePosts < ActiveRecord::Migration
def self.up
create_table :posts do |t|
t.string :title

t.timestamps
end
end

def self.down
drop_table :posts
end
end
21 changes: 21 additions & 0 deletions db/schema.rb
@@ -0,0 +1,21 @@
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20110306213139) do

create_table "posts", :force => true do |t|
t.string "title"
t.datetime "created_at"
t.datetime "updated_at"
end

end
Binary file removed public/images/rails.png
Binary file not shown.

0 comments on commit 8726137

Please sign in to comment.