Scenario:
Table in database has two fields, id and category (table name is:
categories)
Controller is named category_controller.rb
Model is named category.rb
Helper is named category_helper.rb
Form is named list.rhtml in view\category directory
The code in play on the form is (from generating scaffold):
<% for category in @categories %>
link_to on form is to action destroy
code that was in action in category_controller (on first attempt that
did not work):
cat = params[:category]
Problem is: cat was nil
Now I worked around it by doing this:
@category = Category.find(params[:id])
cat = @category.category
So, why if I can get the value of params[:id] from the form cannot I not
also get the value of param[:category]?
Is it possible I am getting a name clash here? And if not a name clash,
then of course the question becomes what might it be?
There doesn’t seem to be any confusion in the form with this line:
But then the context seems such that there wouldn’t be, but perhaps the
context is not so clear in the action in the controller?