over 1 year ago

对命令的理解
rails new:新建一个专案。

Github中
fork 其他人用叉子把代码从A处叉过来
post request 其他人把自己修改的东西让A看到。

cd 命令切换目录
mkdir创建目录

git的作用:托管代码。
git init 建立git仓库
生成的.git目录下.git/config文件中,记录着branch、remote等信息。
heroku作用:免费托管网站,支持5个,特点:比较慢。
heroku run //使用该命令才可以在远端操作heroku。

route.rb作用
控制网站访问的所有的路径。

resources :jobs do
    resources :resumes
  end
end

namespace :admin do //给一个命名的空间。
    resources :jobs do
    resources :resumes
    member do
    post :publish
    post :hide
     //在controller里定义了的动作
    end
  end
end

使用rake routes命令,可以看到Perfix列是所有的路径,Verb是操作的方法,Controller#Action ?

              Prefix Verb   URI Pattern                                Controller#Action
    new_user_session GET    /users/sign_in(.:format)                   devise/sessions#new
        user_session POST   /users/sign_in(.:format)                   devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format)                  devise/sessions#destroy
       user_password POST   /users/password(.:format)                  devise/passwords#create
   new_user_password GET    /users/password/new(.:format)              devise/passwords#new
  edit_user_password GET    /users/password/edit(.:format)             devise/passwords#edit
                     PATCH  /users/password(.:format)                  devise/passwords#update
                     PUT    /users/password(.:format)                  devise/passwords#update
cancel_user_registration GET    /users/cancel(.:format)                    devise/registrations#cancel
   user_registration POST   /users(.:format)                           devise/registrations#create
   new_user_registration GET    /users/sign_up(.:format)                   devise/registrations#new
  edit_user_registration GET    /users/edit(.:format)                      devise/registrations#edit
                     PATCH  /users(.:format)                           devise/registrations#update
                     PUT    /users(.:format)                           devise/registrations#update
                     DELETE /users(.:format)                           devise/registrations#destroy
          join_group POST   /groups/:id/join(.:format)                 groups#join
          quit_group POST   /groups/:id/quit(.:format)                 groups#quit
         group_posts GET    /groups/:group_id/posts(.:format)          posts#index
                     POST   /groups/:group_id/posts(.:format)          posts#create
      new_group_post GET    /groups/:group_id/posts/new(.:format)      posts#new
     edit_group_post GET    /groups/:group_id/posts/:id/edit(.:format) posts#edit
          group_post GET    /groups/:group_id/posts/:id(.:format)      posts#show
                     PATCH  /groups/:group_id/posts/:id(.:format)      posts#update
                     PUT    /groups/:group_id/posts/:id(.:format)      posts#update
                     DELETE /groups/:group_id/posts/:id(.:format)      posts#destroy
              groups GET    /groups(.:format)                          groups#index
                     POST   /groups(.:format)                          groups#create
           new_group GET    /groups/new(.:format)                      groups#new
          edit_group GET    /groups/:id/edit(.:format)                 groups#edit
               group GET    /groups/:id(.:format)                      groups#show
                     PATCH  /groups/:id(.:format)                      groups#update
                     PUT    /groups/:id(.:format)                      groups#update
                     DELETE /groups/:id(.:format)                      groups#destroy
                root GET    /                                          groups#index
      account_groups GET    /account/groups(.:format)                  account/groups#index
                     POST   /account/groups(.:format)                  account/groups#create
   new_account_group GET    /account/groups/new(.:format)              account/groups#new
  edit_account_group GET    /account/groups/:id/edit(.:format)         account/groups#edit
       account_group GET    /account/groups/:id(.:format)              account/groups#show
                     PATCH  /account/groups/:id(.:format)              account/groups#update
                     PUT    /account/groups/:id(.:format)              account/groups#update
                     DELETE /account/groups/:id(.:format)              account/groups#destroy
       account_posts GET    /account/posts(.:format)                   account/posts#index
                     POST   /account/posts(.:format)                   account/posts#create
    new_account_post GET    /account/posts/new(.:format)               account/posts#new
   edit_account_post GET    /account/posts/:id/edit(.:format)          account/posts#edit
        account_post GET    /account/posts/:id(.:format)               account/posts#show
                     PATCH  /account/posts/:id(.:format)               account/posts#update
                     PUT    /account/posts/:id(.:format)               account/posts#update
                     DELETE /account/posts/:id(.:format)               account/posts#destroy

显示默认隐藏的devise目录
rails generate devise:views

 <div class="col-md-4 col-md-offset-4">// md是指中等屏幕  col-sd-4小屏幕  col-lg-4 大屏幕  
 //最后的数字是网页平均分为12份,占了几份大小。
 //col-md-offset-4是指往右移动4份大小的距离。
 </div>
← 1/20 日记 1/21 周记 →
 
comments powered by Disqus