DEV Community

Discussion on: Using Query Parameters in Rails Controllers

Collapse
 
juanvqz profile image
Juan Vasquez • Edited

Suggestion, because I think it’s easier to read it.
if request.query_prameters.any?

And I think you can use this one too

@plants = @plants.presence || @user.plants
If plants is already defined it won’t consult the @user.plants again

Collapse
 
karsonkalt profile image
Karson Kalt

Thanks for the tip Juan, implemented and updated!

Collapse
 
juanvqz profile image
Juan Vasquez

thank you for share