Brian Gilbank

Joined

9,090 Experience
61 Lessons Completed
3 Questions Solved

Activity

Posted in Accessing The Rails test.key on GitHub Actions

I have credential files and keys for production, development, and test. Meaning I have no master.key file.

How do I then access my test.key using GitHub actions?

Using these approaches does not work:

RAILS_TEST_KEY: ${{ secrets.RAILS_MASTER_KEY }}
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}

I did, but I am not remembering how I did it at the moment. I believe I created another model that inherited from the User model.

Posted in Hotwire Not Working Inside of Namespace

This seems like an easy fix, but I am not sure why its not working. I have an admin dashboard using Hotwire, but I can't seem to create records for my gym model (There are no errors, and it will work when I refresh). I can create records outside the namespace using the same model though, and using the same setup as below.

Do I need to pass the namespace in with the dom_id for Hotwire to work? Or is it an issue with the form_with namespace?

example namespace form
<%= form_with(model: [:dashboard, gym]) do |f| %>
 *fields
<% end %>

_gym.html.erb
<div id="<%= dom_id gym %>" class="card">
 *content
</div>

show.html.erb
<%= render @gym %>

Posted in How to write System Tests in Rails Discussion

For anyone using i18n you can do something like this:

require "application_system_test_case"

class AccountsTest < ApplicationSystemTestCase
  test "Can register for an account" do
    visit new_account_registration_path

    assert_difference("Account.count") do
      fill_in I18n.t("rnew.name"), with: "Tom Hanks"
      fill_in I18n.t("rnew.email"), with: "thanks@gmail.com"
      fill_in I18n.t("rnew.company"), with: "Cast Away"
      fill_in I18n.t("rnew.password"), with: "password850$"
      fill_in I18n.t("rnew.password_confirm"), with: "password850$"

      click_button I18n.t("rnew.register")
    end
  end
end

Posted in Bulk Operations in Rails Discussion

I am trying to make this work with rails request.js but not having much luck.

My flash partial renders in the terminal, but there's no content or message. Not sure what is going on. I am not re-directing after create, so do I need to use flash.now somehow?

Posted in How to use Rails Request.js Discussion

Hey Chris - How would you re-render a partial after publish/unpublish? Add a turbo frame tag to the partial? I want to re-render the edit page.

Posted in How to use Hotwire in Rails Discussion

I can't get any of my delete links to work, has this happened to anyone else?

Posted in Rails for Beginners Part 17: Login Form Discussion

Yes I know. I meant be able to login with either at the same time, similar to how you do it with Devise. https://github.com/heartcombo/devise/wiki/How-To:-Allow-users-to-sign-in-using-their-username-or-email-address

Posted in Rails for Beginners Part 17: Login Form Discussion

It would be great to show how to do login with both username and email as well.

Posted in How to use Devise with Hotwire & Turbo.js Discussion

Hey Chris - If we are still using Webpacker, we just need to change data-turbolinks-track to data-turbo-track in our layout files? In your episode repo, you still have it as turbolinks.

<%= stylesheet_link_tag 'application', media: 'all', 'data-turbo-track': 'reload' %>
<%= javascript_pack_tag 'application', 'data-turbo-track': 'reload' %>

<%= turbo_include_tags %>

<%= stimulus_include_tags %> if we want to use stimulus in webpacker?

Posted in How do I search Action Text with Ransack?

Thanks, I will play around with it and see what I can figure out.

Posted in How do I search Action Text with Ransack?

Thank you! I am now getting duplicates in my searches though. Did that happen to you?

Posted in How to Add Pagination with Pagy Discussion

If we are counting records, ie. <%= index + 1%> how can we keep the count going when we we navigate to the next page? Currently my next page starts at 1 again.

Posted in Skipping Devise Confirmation for Stripe Signup

Hi Chris - How could I skip the Devise confirmation if a user is signing up to pay with Stripe?

I am following this video on your stripe course: https://courses.gorails.com/courses/payments-with-rails-master-class/152586-subscriptions-with-stripe-billing/451458-3-4-new-subscription-form

I was hoping I could do something like below.

class Users::RegistrationsController < Devise::RegistrationsController
invisible_captcha only: [:create], honeypot: :telephone, scope: :user, on_spam: :return_succeded

def create
super
if @user.persisted?
UserMailer.newuser_email(@user).deliver
end
if @user.persisted? && current_user.subscribed?
@user.skip_confirmation!
@user.confirm
end
end

end

Thanks
Brian

Posted in Action Text Colours & More Heading Options

Hey Chris - Is it possible to add a colour picker to action text, i.e. select some text and change its colour? Seems like a basic thing that should be included. It would be great if there were more heading options too. Maybe it will get an update because of hey.com?

Posted in Iterating using css grid

I had to add partial and it worked. Cheers,

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

Posted in Iterating using css grid

Hmm, still throwing the same error.

Posted in Iterating using css grid

I had it originally in a partial, but it was throwing an error for undefined local variable or method for gym.

<% if gym.image.present? %>

Posted in Iterating using css grid

Omg! I will get this one day. Thanks again.