From the course: Ruby on Rails 5 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Adding RubyGems: acts_as_list

Adding RubyGems: acts_as_list - Ruby on Rails Tutorial

From the course: Ruby on Rails 5 Essential Training

Start my 1-month free trial

Adding RubyGems: acts_as_list

- [Instructor] In this movie, we're gonna learn more about RubyGems, and we're going to install the acts_as_list RubyGem, and use it in our project. I'm not sure if you noticed, but our sort positions that are in front of all of our Subjects, our Pages, and our Sections are a bit of a mess. You can see right here, I've got two number ones, Initial Subject and Default subject both have the same number, there's nothing preventing that from happening. It's also maybe a little less obvious, but if we go to our Pages and we click on Edit, we get a list of the sort positions that we can choose for this page. But that's a list of all sort positions, remember we're just counting the pages, and that's how we know which ones there are. What we really want is to limit that just to the pages for this subject. We want to have the count and our positions be scoped by the subject as well. We know how to fix that problem. We just need to go into our Controllers, into PagesController, and we have…

Contents