In Course2(Rapid Prototyping with Ruby on Rails), first week I learned about Models and database
, second week I learned about Controllers and Views
. This week I learned to add some features into my app, and make it vivid!!
- Feb 16, 2015...more
Tealeaf Course2 Lesson3 Quiz
Feb 15, 2015...more####1. What’s the difference between rendering and redirecting? What’s the impact with regards to instance variables, view templates?
- rendering: render a template HTML code, like
partial
. - redirecting: make a new request to controller.
- rendering: render a template HTML code, like
Reflection to Tealeaf Course2 Lesson2
Feb 10, 2015...moreLast week, I know Models and Database side of Rails.
This week Tealeaf reveals the
Controller
andView
part of MVC, I would like to summarize this lesson into two parts:Don't Repeat Yourself
andConventions over Configuration
.Tealeaf Course2 Lesson2 Quiz
Feb 8, 2015...more####1. Name all the 7 (or 8) routes exposed by the resources keyword in the routes.rb file. Also name the 4 named routes, and how the request is routed to the controller/action.
For example by table
posts
:Prefix Verb URI Controller#Action posts GET /posts posts#index new_post GET /posts/new post#new POST /posts post#create post GET /posts/:id post#show edit_post GET /posts/:id post#edit PUT/PATCH /posts/:id post#update DELETE /posts/:id post#destroy Newbie for Rails Migration
Feb 2, 2015...moreAs a newbie for Rails, It’s normal to do something stupid.
Modified migration files after
rake db:migrate
It’s useless!! Be carful that every migration filename including a timestamp, after running
rake db:migrate
will re-generate schema.rb. Data in schema.rb will show that the lastest timestamp, if there is no any new migration files newer than this timestamp,rake db:migrate
will do nothing. Yes! it’s nothing!!normally you should see 1
2
3
4== CreateArticles: migrating ==================================================
-- create_table(:articles)
-> 0.0019s
== CreateArticles: migrated (0.0020s) =========================================schema.rb has been updated, rake db:migrate do nothing 1
2$ rake db:migrate
$ rake db:migrateReflection to Tealeaf Course 2 Lesson 1
Feb 2, 2015...moreTealeaf Course2 Lesson1 Quiz
Jan 30, 2015...moreAnswer these quizzes, then updated after watching solution.
##1. Why do they call it a relational database?
Relational database can store the relationship between data and data. For example, a table store customer’s info, and a table store consuming record, these two table can be associated with another table, to establish the customer’s consuming history. There are relationships between data and data in relational database. ex. sqlite, MySQL, PostgreSQL ect.
the tables within the database are associated with each other. This association can be created with primary/foreign keys and various syntax.
##2. What is SQL?
SQL(Structured Query Language), it’s domain specific language to manipulate database.
Reflection to Tealeaf Lesson 4
Jan 22, 2015...more在Nitrous上寫Octopress
Jan 16, 2015...more###Octopress & github
這個部落格是用Octopress在github上建立起來的。但是不像一般的部落格系統,可以只要用瀏覽器登入,就可以開始寫文章。不過既然知道nitrous.io可以雲端工作,所以就把腦筋動到它的上面去。###Clone Octopress
作法是參考這篇文章。但是其中的程式碼有點錯誤,因為github上存放網頁的位置己經改成github.io了。
show HTTP is stateless by Sinatra
Jan 14, 2015...moreIn tealeaf week 3, introduce to HTTP.
The most important thing is that, HTTP is stateless.
What’s the influnce by this property? Showing this by Sinatra.