Tag: scaffolding

如何从脚手架完成rspec put控制器测试

我正在使用脚手架来生成rspec控制器测试。 默认情况下,它会将测试创建为: let(:valid_attributes) { skip(“Add a hash of attributes valid for your model”) } describe “PUT update” do describe “with valid params” do let(:new_attributes) { skip(“Add a hash of attributes valid for your model”) } it “updates the requested doctor” do company = Company.create! valid_attributes put :update, {:id => company.to_param, :company => new_attributes}, valid_session company.reload […]

如何在Rails 3中使用“额外描述”生成数据类型的脚手架?

从Ruby on Rails:处理货币/货币的最佳方法,您如何为以下内容生成脚手架: add_column :items, :price, :decimal, :precision => 8, :scale => 2 如: rails generate scaffold LineItem name:string \ price:decimal {:precision => 8, :scale => 2} 此外,十进制类型的“额外描述”的正确术语是什么? 使用Rails 3.07,Ruby 1.92