Re: [Rails] Re: get request to new action using form instead of link causes param is missing or the value is empty error

2019-10-04 Thread Ariel Juodziukynas
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

[Rails] Re: get request to new action using form instead of link causes param is missing or the value is empty error

2019-10-04 Thread fugee ohu
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

[Rails] Re: get request to new action using form instead of link causes param is missing or the value is empty error

2019-10-04 Thread Avdhesh Sharma (ROR)
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