Ok. I use post because I'm sending data to the backend. You use get when you "want" something only (nothing to send in the body request). The key part is the method name: filter. Ensure the name filter matches the name of your view path/filename. This is a rails convention.
Namespacing.
In this post, I'm talking about customers so you'll have a path like this:
/controllers/customers/*
In that folder, you'll have all the controllers (classes) related to "customer":
Alright thanks for the details. I didn't use filter but search and I made sure the views path matched but I'm still getting the error in the SO post.
Would be useful if you someday get your hand on your repo so I can compare more precisely ;)
Could be many things. Your form is also missing the data-remote="true" That is needed and you're submitting with a button. Different from what I have. When I can I'll have a look.
Hi @maxencep40 . What are you referring to exactly? An example?
Thank you for your answer. I created a SO post about the issue I'm facing here. Did you keep your repo of this post ?
Ok. I use
post
because I'm sending data to the backend. You useget
when you "want" something only (nothing to send in the body request). The key part is the method name:filter
. Ensure the namefilter
matches the name of your view path/filename. This is a rails convention.Namespacing.
In this post, I'm talking about customers so you'll have a path like this:
/controllers/customers/*
In that folder, you'll have all the controllers (classes) related to "customer":
/controllers/customers/customers_controller.rb
(CRUD actions)/controllers/customers/filter_controller.rb
(All other actions that are not CRUD)I talk about keeping your controller folders organised instead of having all the files in
controllers/
. Models would be the same:/models/customers/<model-name>.rb
Alright thanks for the details. I didn't use filter but search and I made sure the views path matched but I'm still getting the error in the SO post.
Would be useful if you someday get your hand on your repo so I can compare more precisely ;)
Could be many things. Your form is also missing the
data-remote="true"
That is needed and you're submitting with a button. Different from what I have. When I can I'll have a look.No it's just that since rails 6.1 you need to put
local: false
to submit via Ajax on theform_with