amountable:一种将 Money 字段附加、管理和汇总到 ActiveRecord 模型的简单而透明的方法

时间:2021-05-29 14:50:26
【文件属性】:
文件名称:amountable:一种将 Money 字段附加、管理和汇总到 ActiveRecord 模型的简单而透明的方法
文件大小:18KB
文件格式:ZIP
更新时间:2021-05-29 14:50:26
Ruby 金额 这个 gem 可以帮助您将 Money 字段集成到 ActiveRecord 模型中,而不必每次都添加新列。 它还有助于管理和汇总模型的各种组件,以在整个应用程序中保持数量定义一致。 安装 添加 gem 'amountable' , github : 'instacart/amountable' 到您的Gemfile 。 然后运行 bundle 和 rake amountable:install:migrations 最后 rake db:migrate 用法 设置模型 class Order < ActiveRecord :: Base act_as_amountable amount :subtotal , sets : [ :total ] amount :delivery_fee , sets : [ :total , :fees ] amoun
【文件预览】:
amountable-main
----.github()
--------dependabot.yml(505B)
--------workflows()
----db()
--------migrate()
----amountable.gemspec(1KB)
----lib()
--------amountable()
--------amountable.rb(4KB)
----Gemfile(39B)
----spec()
--------amountable()
--------internal()
--------spec_helper.rb(593B)
--------support()
----Rakefile(114B)
----LICENSE(732B)
----README.md(2KB)
----.rspec(9B)
----.gitignore(87B)

网友评论