Chris Oliver

Joined

292,760 Experience
93 Lessons Completed
296 Questions Solved

Activity

Posted in How to build a wizard

I like that idea. Honestly for most wizard things, I have used Wicked (https://github.com/zombocom/wicked) just about every time. It controls the steps for you and stores them on the model so it remembers the location and everything.

I'd probably still recommend Wicked, but it'd be great to do a basic walkthrough of how you'd implement this from scratch too.

I would pass in the search params into the employee show URL so you can have a link back to the search results that includes the same params.

Ah sorry I was confused. I was thinking of the "active" state of a link / tab / etc.

He's referring to active like the &:active { css selector.

You either need to define it or just have it add the classes you want to the list. "Active" means very different things depending on your UI design.

I either do it inline or in a helper.

Here's an inline example:

<%= link_to "Account", account_path, class: ["blue", ("active" if request.path == account_path)]

Hey Fahad,

Try using this gem to add ActiveStorage support instead: https://github.com/Dreamersoul/administrate-field-active_storage

Posted in Iterating using css grid

Yeah, you want to pass it in as a local variable like so:

<%= render 'gyms/card', locals: { gym: gym, index: index } %>

Partials need locals passed in so it can assign those variables and use them the same way as the parent template was.

Posted in Iterating using css grid

One thing that can help is extracting out things into partials, that way you can see your code a bit clearer. Looks like you were on that path, but it's commented out. I try and do that from the very beginning and that makes sure I have my loops setup correctly.

Posted in Iterating using css grid

You've got 18 per page in your pagination. Then you're not using the slice you defined.

<% @gyms.each_slice(3) do |gyms| %>
  <% @gyms.each_with_index do |gym, index| %>

You see the second line where you're using @gyms a second time? That should be gyms

You're accidentally looping through each group of 3, then rendering all 18 for each of those groups. 😜

Posted in Subscriptions with Stripe Discussion

I've turned it into a separate course since Stripe changes so much and it's hard to maintain these videos. https://courses.gorails.com/payments-with-rails-master-class

Posted in Iterating using css grid

Tailwind isn't your typical framework. It's just classes that wrap like one line of CSS so you'll end up learning CSS really quickly and better this way I've noticed. That's how I taught myself grid in the last month actually.

Posted in Iterating using css grid

And actually, if I were using TailwindCSS for CSS grid, I would do the following and set the grid to 3 columns.

<div class="grid grid-cols-3">
  <% posts.each_with_index do |post, index| %>
    <div>
      <%= post.title %>
    </div>
  <% end %>
</div>

Posted in Iterating using css grid

Yep, makes sense. You need to slice the array into groups of 3, then loop through each one of those instead.

<% @posts.each_slice(3) do |posts| %>
  <% posts.each_with_index do |post, index| %>
    <div class="grid-<%= index + 1%>">
      <%= post.title %>
    </div>
  <% end %>
<% end %>

Posted in Jekyll as a support page?

If you compiled them so they output to public/support that would probably do the trick.

Posted in Getting back into Rails

The biggest changes in Rails are around Webpacker + Stimulus + ActionCable, so any of the videos that cover those topics would be a great place to start. 👍

Posted in Installation

If you need that, sure. I would probably try to keep all my apps running the same Node version though and just update it on the server periodically. That way you can make sure none of your apps get neglected on an insecure Node version and keeps things simpler. That's what I'm currently doing.

Posted in Acts_As_Tentant User have access to many tenants

@Tim Dowling In Jumpstart Pro, tenant is stored depending on how you want your app to work. We can use the session, the URL (like basecamp does), the subdomain, or the actual domain. Session is the default since it's the least invasive and simplest option.

Posted in Soft Delete with Paranoia Discussion

I still use it for most things, but there's also https://github.com/jhawthorn/discard

I got some time yesterday to update the library to automatically handle it as long as there's an ID on the tab. 👍

Posted in How to use Action Mailbox in Rails 6 Discussion

Emails have a message-id and in-reply-to header that you can use for tracking that info. I haven't played with it too much, but you'd probably want to save the message-id after an email is sent, and always make sure you include the in-reply-to as necessary.