There are 2 classes: Task and Project . Related to each other by has_many - belouse_to .
Class models:
class Task < ActiveRecord::Base belongs_to :project end class Project < ActiveRecord::Base has_many :tasks, dependent: :destroy end How to display project.name value in view task#index ?
Pulling out the project id that owns the current task simple: <%= task.project_id %> , but instead of id can’t display the project name. Tell me how this can be implemented?
taskfilled, since you use it? And why do you use a code in the controller that finds the value and throws it away? - D-side<%= выражение %>and what the controller should do. I recommend going through the Rails Tutorial . - D-side