Bryan Beshore

Joined

1,060 Experience
9 Lessons Completed
0 Questions Solved

Activity

Posted in Routing Concerns and Scopes in Rails Discussion

Neat episode!

Posted in How to build a wizard

FWIW. I have since built a SPA type approach for this that works really well, and the data is not stored in session which has it's own benefits.

This said, I think an episode or even a series on this would be great. There are a ton of really interesting ways to do wizards, and there are a ton of reasons why an app would need one.

IIRC I put the alert in the controller, for example, on create.

Posted in Rails view_components

+1

Posted in API HTTP Requests using Faraday Discussion

Just cloned the repo and am running into the same issue:

irb(main):001:0> client
Traceback (most recent call last):
        2: from bin/console:21:in `<main>'
        1: from (irb):1
NameError (undefined local variable or method `client' for main:Object)

If I set as an instance variable: @client = Vultr::Client.new(api_key: ENV["VULTR_API_KEY"])

Result:

irb(main):002:0> @client
=> #<Vultr::Client:0x000000012232a730 @api_key=nil, @adapter=:net_http, @stubs=nil>
irb(main):003:0> 


Hi Samantha O. Wondering if you ever figured out how to set this up? I am just now looking into setting up a wizard and am curious about using stimulus vs. wicked, etc. Any guidance/thoughts would be amazing. Thanks!

Posted in How to build a wizard

I third this. All in favor say aye?

Edit: After a lot of “trying to wrangle together” a complex wizard using wicked, I finally gave up and built my own. Pretty happy with the outcome (so far.) would still love to see both with wicked (more complex than scoping to user) and rolling your own.

Posted in API HTTP Requests using Faraday Discussion

Also ran into this issue. When converting to an instance variable, this worked. @stephen, did you run into any errors after this? Or were things successful for you?

Thanks.

Attempting to use the following gem in a new rails application: https://github.com/excid3/tailwindcss-stimulus-components

Main reason is that the new supported tailwind gem that you can install directly with a new build does not seem to allow for plugins: @tailwindcss/forms for example.

Added the following:

app/javascript/controllers/application.js

Tried both the default: import { Application } from "@hotwired/stimulus" and the below:

// Start StimulusJS
import { Application } from "stimulus"

const application = Application.start();

// Import and register all TailwindCSS Components
import { Alert, Autosave, Dropdown, Modal, Tabs, Popover, Toggle, Slideover } from "tailwindcss-stimulus-components"
application.register('alert', Alert)
application.register('autosave', Autosave)
application.register('dropdown', Dropdown)
application.register('modal', Modal)
application.register('tabs', Tabs)
application.register('popover', Popover)
application.register('toggle', Toggle)
application.register('slideover', Slideover)

Added a controller: rails g controller static home

Changed routes to Static#home

Added the alert example to app/views/static/home.html.erb

<div class="fixed inset-x-0 top-0 flex items-end justify-right px-4 py-6 sm:p-6 justify-end z-30 pointer-events-none">
  <div data-controller="alert" class="max-w-sm w-full shadow-lg rounded px-4 py-3 rounded relative bg-green-400 border-l-4 border-green-700 text-white pointer-events-auto">
    <div class="p-2">
      <div class="flex items-start">
        <div class="ml-3 w-0 flex-1 pt-0.5">
          <p class="text-sm leading-5 font-medium">
            Stimulus is the JS of the future!
          </p>
        </div>
        <div class="ml-4 flex-shrink-0 flex">
          <button data-action="alert#close" class="inline-flex text-white focus:outline-none focus:text-gray-300 transition ease-in-out duration-150">
            <svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
              <path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"/>
            </svg>
          </button>
        </div>
      </div>
    </div>
  </div>
</div>

I am up for using something other than tailwind-stimulus-components. I mainly would like to use the tailwind ui components from this: https://tailwindui.com/ in a new rails application

Thanks.

Posted in Setup MacOS 12 Monterey Discussion

You likely figured it out already, but possibly this will help others: restart your terminal and you should see 3.0.2

Posted in Deploy Ubuntu 18.04 Bionic Beaver Discussion

I am seeing an odd error (at least odd to me, and I have spent a good portion of the day trying to figure this out to no avail:

I run on local: cap production deploy

Deployment starts, but at deploy:migrate, I have an issue:

00:31 deploy:migrate
      [deploy:migrate] Run `rake db:migrate`
00:31 deploy:migrating
      01 $HOME/.rbenv/bin/rbenv exec bundle exec rake db:migrate
      01 rake aborted!
      01 PG::ConnectionBad: could not connect to server: Connection refused
      01    Is the server running on host "165.227.190.133" and accepting
      01    TCP/IP connections on port 5432?

...
...

#<Thread:0x00007fc18a23b8a8@/Users/BryanBeshore/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
    1: from /Users/BryanBeshore/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/Users/BryanBeshore/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as deploy@165.227.190.133: rake exit status: 1 (SSHKit::Runner::ExecuteError)
rake stdout: Nothing written
rake stderr: rake aborted!
PG::ConnectionBad: could not connect to server: Connection refused
    Is the server running on host "165.227.190.133" and accepting
    TCP/IP connections on port 5432?

UPDATE:
Ok. I am ... an idiot unless I have 5-cups of coffee in me and I take breaks after 10+hrs staring at a computer monitor.

I had two setups for the following when I should have only had one. One was directed to: myapp (literal) and myapp (my actual app). And I directed the IP to my actual IP address instead of 127.0.0.1
nano ~/myapp/.rbenv-vars

Posted in API Authentication with an OAuth Provider Discussion

@Megazoor,

Thanks for the workaround. Worked for me.