https://apidock.com/ruby/Hash/fetch
fetch tries to get the value from a hash given a key, the second parameter
is a fallback in case the key does not exist on the hash (params), in your
case, if params[:item] does not exist, it returns {} so the next .fetch
won't fail. now the second .fetch tries
On Friday, October 4, 2019 at 6:32:20 AM UTC-4, Avdhesh Sharma (ROR) wrote:
>
> Because in form_tag we don't define scope so all parameters comes in
> params directry.
> so you need to fix *item_params* method
> *params.permit(:item_type)* to permit parameters
>
> your's item_params method is
Because in form_tag we don't define scope so all parameters comes in params
directry.
so you need to fix *item_params* method
*params.permit(:item_type)* to permit parameters
your's item_params method is written to permit this params structure
{item: {item_type: q}
On Friday, October 4, 2019 at
3 matches
Mail list logo