params_for:使用 ActiveModel 电源验证 Rails 控制器参数

时间:2021-07-04 23:52:39
【文件属性】:
文件名称:params_for:使用 ActiveModel 电源验证 Rails 控制器参数
文件大小:10KB
文件格式:ZIP
更新时间:2021-07-04 23:52:39
Ruby 参数为 使用服务对象和ActiveModel::Validations的强大功能来轻松验证控制器中的参数。 安装 将此行添加到您的应用程序的Gemfile : gem 'params_for' 然后执行: $ bundle 或者自己安装: $ gem install params_for 用法 在您的控制器中: # app/controllers/fancy_controller.rb class FancyController < ApplicationController include ParamsFor :: Connectors :: Glue params_for :fancy , only : [ :create ] # Creates a Fancy object by checking and validating params # be
【文件预览】:
params_for-master
----.travis.yml(128B)
----Rakefile(29B)
----params_for.gemspec(1KB)
----Gemfile(95B)
----spec()
--------shared()
--------params_for()
--------spec_helper.rb(395B)
----.gitignore(118B)
----lib()
--------params_for.rb(243B)
--------params_for()
----README.md(2KB)
----LICENSE.txt(1KB)

网友评论