The third line above is post '/movies' => 'movies#create', :as => 'movies'

Eight line all in resources 'movies'.
(One more is PATCH update(partial))

:as name should be singular when it applies to one resource, plural when it applies to the collection.

Rails route which is abstract, subtle different from concrete HTTP route(HTTP Method + URI).

Rails 的 route 是对 HTTP route 的抽象,是“匹配并分发”这一层的定义。 可以理解为:Rails route = HTTP route 模式 + 控制器映射。

The Root Route

An Example

The way controller renders a view is that rails will automatically find the corresponding view file and analyze, run all pre-processor needed (hamlhtml in this case) and eventually convert it into HTML, JSON etc that browser can handle with and then return.

Route Helper Functions

as: xxx
Then xxx_path will be evaluated to a route that :as’s value is xxx.

Summary

Routes for Association

movie_reviews_path(m) in line 3