title: Edit field is blank (rails 6.1.4)
body: <p>I am new to Ruby on Rails and we have a project called TaskApp.</p>
  <p>It that has 2 models: Category, Task.</p>
  <p>Category has many tasks and Task belongs to Category.</p>
  <p>When I go from tasks index to edit task, I am getting the edit view with blank fields.</p>
  <p>Please find relevant codes below.</p>
  <p>I am grateful for any advise to get me to resolve this.</p>
  <pre><code>routes.rb
  
  Rails.application.routes.draw do
    devise_for :users, controllers: { registrations: 'registrations' }
    get 'home/index'
    root 'home#index'
    resources :categories do
      resources :tasks
    end
  end
  </code></pre>
  <pre><code>tasks_controller.rb
  class TasksController &lt; ApplicationController
    before_action :authenticate_user!
    before_action :set_category, except: %i[index edit]
    before_action :set_task, only: %i[show update destroy]
  
    def index
      @tasks = Task.where(user_id: current_user.id, deadline: Time.zone.now.beginning_of_day..Time.zone.now.end_of_day).order(priority: :asc)
    end
  
    def new
      @task = @category.tasks.build
    end
  
    def show
    end
  
    def create
      @task = @category.tasks.create(task_params.merge(user_id: current_user.id))
      respond_to do |format|
        if @task.save
          format.html { redirect_to @task.category, notice: &quot;Task was successfully created.&quot; }
          format.json { render :show, status: :created, location: @task.category }
        else
          format.html { redirect_to @task.category, notice: &quot;Invalid inputs.&quot; }
          format.json { render json: @task.errors, status: :unprocessable_entity }
        end
      end
    end
  
    def edit
      @category = Category.find(params[:category_id])
      @task = @category.tasks.find(params[:id])
    end
  
    def update
      respond_to do |format|
        if @task.update(task_params)
            format.html { redirect_to @task.category, notice: 'Task was successfully updated.' }
            format.json { render :show, status: :ok, location: @task }
        else
            format.html { render :edit }
            format.json { render json: @task.errors, status: :unprocessable_entity }
        end
      end
    end
  
    def destroy
      @task.destroy
      respond_to do |format|
        format.html { redirect_to @task.category, notice: 'Task was successfully destroyed.' }
        format.json { head :no_content }
      end
    end
  
    private
      def set_category
        @category = Category.find(params[:category_id])
      end
  
      def set_task
        @task = @category.tasks.find(params[:id])
      end
  
      def task_params
        params.require(:task).permit(:name, :description, :priority, :deadline, :completed, :user_id, :category_id)
      end
  end
  </code></pre>
  <pre><code>.../tasks/views/edit.html.erb
  &lt;div&gt;
      &lt;table&gt;
        &lt;thead&gt;
          &lt;tr&gt;
            &lt;th&gt;Name&lt;/th&gt;
            &lt;th&gt;Description&lt;/th&gt;
            &lt;th&gt;Priority&lt;/th&gt;
            &lt;th&gt;Deadline&lt;/th&gt;
            &lt;th&gt;Completed&lt;/th&gt;
            &lt;th&gt;Action&lt;/th&gt;
            &lt;th&gt;Action&lt;/th&gt;
          &lt;/tr&gt;
        &lt;/thead&gt;
        &lt;tbody&gt;
          &lt;% @category.tasks.each do |task| %&gt;
            &lt;% if task.user_id == current_user.id %&gt;
              &lt;tr&gt;
                &lt;td&gt;&lt;%= link_to task.name, [task.category, task] %&gt;&lt;/td&gt;
                &lt;td&gt;&lt;%= task.description %&gt;&lt;/td&gt;
                &lt;td&gt;&lt;%= task.priority %&gt;&lt;/td&gt;
                &lt;td&gt;&lt;%= task.deadline.strftime(&quot;%d %b %Y&quot;) %&gt;&lt;/td&gt;
                &lt;td&gt;&lt;%= task.completed %&gt;&lt;/td&gt;
                &lt;td&gt;&lt;%= link_to 'Edit', edit_category_task_path(task.category, task) %&gt;&lt;/td&gt;
                &lt;td&gt;&lt;%= link_to 'Delete', [task.category, task],
                            method: :delete,
                            data: { confirm: 'Are you sure?' } %&gt;
                &lt;/td&gt;
              &lt;/tr&gt;
            &lt;% end %&gt;
          &lt;% end %&gt;
        &lt;/tbody&gt;
      &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>