solnic on master
Cast identifier to String durin… Merge pull request #169 from ad… (compare)
Range#include?should work I think?
predicate(:included_in?) do |list, input| list.include?(input) end predicate(:includes?) do |value, input| input.include?(value) end
One more thing provided by @marshall-lee for initializer in our commercial project is the
It allows to set object dependency as either model or model id.
In Rails projects this proves to be very suitable (example below is over-simplified):
class DestroyUser ar_param :user def call user.destroy end def self.call(*args) new(*args).call end end user_id = 1 user = User.find 1 # This methods are the same DestroyUser.call user_id DestroyUser.call user
Under the hood the method either gets an activerecord instance or finds its by id (or by another argument):
ar_param :user, find_by: :key
The question is what do you think about implementing this behaviour in a submodule of
 pry(main)> LocalSearch::Types::Form::Bool['1'] => true  pry(main)> LocalSearch::Types::Form::Bool['0'] => false  pry(main)> LocalSearch::Types::Form::Bool['false'] => false  pry(main)> LocalSearch::Types::Form::Bool['False'] => "False"