brycesenz / simple_params Goto Github PK
View Code? Open in Web Editor NEWA simple class for specifying parameters for an API, service object, etc.
A simple class for specifying parameters for an API, service object, etc.
Failure/Error: message = normalize_message(attribute, message, options)
NoMethodError:
undefined method `normalize_message' for #<SimpleParams::Errors:0x000055becb5cb888>
Did you mean? normalize_arguments
After solving the above there are subsequent issues. I attempted to make the changes myself, but quickly got in over my head.
simple_action and simple_params have been really useful for us. Thanks for your work on them.
In order to SimpleParams objects to work seamless with Rails forms, they need to support a few different methods:
When a set of params has an optional nested array, it still returns errors if the optional array is not initialized. I need to add a spec to verify the correct functionality and fix this issue.
The Params class is becoming incredibly bloasted and complex. It should be split into sub classes, and ideally separated into other modules as well.
Here is an example backtrace:
ArgumentError:
Class name cannot be blank. You need to supply a name argument when anonymous class given
# /Users/user/.rvm/gems/ruby-2.2.0@app/gems/activemodel-4.2.0/lib/active_model/naming.rb:148:in initialize' # /Users/user/.rvm/gems/ruby-2.2.0@app/gems/activemodel-4.2.0/lib/active_model/naming.rb:239:in
new'
# /Users/user/.rvm/gems/ruby-2.2.0@app/gems/activemodel-4.2.0/lib/active_model/naming.rb:239:in model_name' # /Users/user/.rvm/gems/ruby-2.2.0@app/gems/activemodel-4.2.0/lib/active_model/errors.rb:418:in
block in generate_message'
ActiveModel has undergone some significant changes, and this gem no longer plays well with Rails 5
Currently, ApiPieDocumentation will consider something with a default to be required. That should not be true.
One should be able to add before and after validation hooks, just like you can on ActiveModel objects.
The following param definition should be valid even when the param is nil -
param :age, optional: true, validations { inclusion: { in: ["a", "b"] } }
But it isn't. I believe that the solution is going to be to add an "allow_nil" tag to the validations hash when optional is true. E.g.
validates :age, :inclusion => { :in => ['a', 'b'] }, :allow_nil => true
This method, and the klass method (http://apidock.com/rails/ActiveRecord/Reflection/AssociationReflection/klass) are ActiveRecord methods that are used in building nested forms.
Our Params class should support these methods in order to be used in the same forms.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.