Giter Site home page Giter Site logo

simple_params's People

Contributors

brycesenz avatar mroguitar avatar wzcolon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

simple_params's Issues

Exceptions and deprecations with Rails 6.1

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.

Add Rails form helper/compatibility methods

In order to SimpleParams objects to work seamless with Rails forms, they need to support a few different methods:

  • Params have to respond to "persisted?"
  • For nested params, e.g., "dogs", then the params should also be able to set those params through "dogs_attributes"
    • Again, for "dogs", params should respond to "build_dog".

Optional nested arrays aren't working correctly.

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.

Error in Rails apps due to a lack of ActiveModel name

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:innew'
# /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:inblock in generate_message'

Optional params aren't optional when validating inclusion

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.