日期:2014-05-16  浏览次数:20367 次

rails base 之数据库---c u d
C
1 create
@tempcourse = Tempcourse.create(
      :name => params[:coursename],
      :cate_id => params[:cate_id],
      :creater_id => params[:creater_id]
    )

2 create 块作为参数
@tempcourse = Tempcourse.create() do |book|
      book.name => params[:coursename],
      book.cate_id => params[:cate_id],
      book.creater_id => params[:creater_id]
end