Last active
January 2, 2016 00:38
-
-
Save Boztown/8224539 to your computer and use it in GitHub Desktop.
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
# SQLite version 3.x | |
# gem install sqlite3 | |
# | |
# Ensure the SQLite 3 gem is defined in your Gemfile | |
# gem 'sqlite3' | |
development: | |
adapter: sqlite3 | |
database: db/development.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: | |
adapter: sqlite3 | |
database: db/test.sqlite3 | |
pool: 5 | |
timeout: 5000 | |
production: | |
adapter: sqlite3 | |
database: db/production.sqlite3 | |
pool: 5 | |
timeout: 5000 |
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 generate scaffold Idea name:string title:string content:text |
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
class CreateIdeas < ActiveRecord::Migration | |
def change | |
create_table :ideas do |t| | |
t.string :name | |
t.string :title | |
t.text :content | |
t.timestamps | |
end | |
end | |
end |
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
idea = Idea.new(:name => 'HaveADrink', :title => 'Have A Drink', :content => 'Just go and have a drink') |
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
1.9.3p125 :002 > idea | |
=> <Idea id: nil, name: "HaveADrink", title: "Have A Drink", content: "Just go and have a drink", created_at: nil, updated_at: nil> |
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
<Idea id: nil, name: "HaveADrink", title: "Have A Drink", content: "Just go and have a drink", created_at: nil, updated_at: nil> |
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
1.9.3p125 :003 > idea.save | |
(0.1ms) begin transaction | |
SQL (182.3ms) INSERT INTO "ideas" ("content", "created_at", "name", "title", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?, ?) [["content", "Just go and have a drink"], ["created_at", Tue, 24 Apr 2012 23:16:26 UTC +00:00], ["name", "HaveADrink"], ["title", "Have A Drink"], ["updated_at", Tue, 24 Apr 2012 23:16:26 UTC +00:00], ["user_id", nil]] | |
(20.1ms) commit transaction | |
=> true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment