ruby - Rails routes "get 'frog'" vs "get :frog" (probably really easy) -
this question has answer here:
this works:
resources :students member 'frog' end end here's understand doing: resources method(?) sending code block member method(?) , telling create action verb 'frog' (which entry in controller, has view, etc.)
this works:
resources :students member :frog end end pretty same, kind of data :frog in version?
i'm trying understand every line of scaffolded app rather take on faith. tutorials claim restful part difficult piece understand, think that's pretty clear. it's rails conventions tripping me up.
any explanations/expansions on above welcome.
in example, :frog ruby symbol. it's converted string call to_s on (try :frog.to_s in irb or console). similarly, can covert string symbol calling to_sym (try "frog".to_sym in irb or console). rails authors decided accept either string or symbol in case, since trivial change 1 other.
Comments
Post a Comment