Ryan Kulp

Joined

1,390 Experience
6 Lessons Completed
1 Question Solved

Activity

Thanks @eelcoj ! I caught that and it still wouldn't work so I dropped the two lines in the controller. Then used project.tasks.each block in the index so I didn't have to create an instance variable after all.

Posted in Dynamic Nested Forms with Stimulus JS Discussion

Nevermind, got it working.

I got it working.

def index
@projects = Project.all
end

Projects#index:

<% project.tasks.each do |task| %>
<%= task.description %>
<% end %>

I am trying to display the Tasks on the Products#index and get Type Error in Projects#index
"can't cast Enumerator"

How can I display attributes from tasks on the Products views?

Here's my code -
ProjectsController:

def index
@projects = Project.all
@projects_id = @projects.find(:project_id)
@tasks = Project.where(:project_id => @projects_id).all
end

Projects#index:
<% @tasks.each do |task| %>
<%= task.description %>
<% end %>

AddIndexToTask migration:
def change
add_index :tasks, :project_id
end

Posted in Dynamic Nested Forms with Stimulus JS Discussion

How do you display the Tasks in the Project Index and Show Views?

Tailwind is working with my Rails app, but crashes when I try to extract classes and use the @apply rule.

The error is:
ActionView::Template::Error (Webpacker can't find application.css in /...manifest.json.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2024 GoRails, LLC. All rights reserved.