常用语句

命令

rails g controller admin::categories
rails generate controller StaticPages home help //定制静态页面
rails destroy controller StaticPages home help //删除
rails generate model User name:string email:string //创建model
rails destroy model User //移除model

view

<%= current_user.email %>
<%= if current_user && current_user == job.user %>

controller

job.user.email
10.times{ |i| Category.create!( :name => "#{i} Category" ) }
@posts = Post.where(:ststus => 'completed').limit(10).order('id DESC')

console

Job.delete_all

你可能感兴趣的:(常用语句)