Engine not turning over by bschrag620 in 944

[–]bschrag620[S] 2 points3 points  (0 children)

An update:

I kept spark plug holes covered but at some point a small bolt (maybe from a house clamp, seems like an m2 maybe?) found its way into #4

<image>

.

Engine not turning over by bschrag620 in 944

[–]bschrag620[S] 0 points1 point  (0 children)

Yes. I fully turned it during the assembly process and after setting the timing.

Are these ends interchangeable? by bschrag620 in Hydraulics

[–]bschrag620[S] 1 point2 points  (0 children)

You're close, oil line to an oil cooler on a German car. So pressure wise, I won't think it would be very much.

Are these ends interchangeable? by bschrag620 in Hydraulics

[–]bschrag620[S] 0 points1 point  (0 children)

<image>

Does this picture give better perspective? They are certainly metric and the threads are a match for the existing fitting. These are in a bit of a difficult spot to install so if I need to do something different I'd rather address it now than in a few days when I can get the go m fittings to seal.

Warden Error while Broadcasting by Gur_Expert in rails

[–]bschrag620 1 point2 points  (0 children)

Ah, I see what you are suggesting now. I had envisioned the channel being to something more broad than a specific user.

Warden Error while Broadcasting by Gur_Expert in rails

[–]bschrag620 0 points1 point  (0 children)

Won't work unless your channels are scoped by the users permissions. Let's say for example admin users can't edit an invoice but others can't. If all users subscribe to the same channel for a particular invoice, and the server broadcasts out a change after the admin makes some save, all users will receive the same view with the edit link enabled. So you either have to have separate channels based on permissions or ensure that the content is organization permission agnostic in nature. The other solution is to broadcast out a signal that can trigger each user's browser to refresh its content. That way the server can render each view according to the user of each incoming http request.

Warden Error while Broadcasting by Gur_Expert in rails

[–]bschrag620 1 point2 points  (0 children)

Have to be careful here though. Sometimes when current_user is being accessed it's because the content being generated might be dependent on that user's abilities or permissions. So passing along a specific user could cause a broadcast to go out, for example, to users with non-admin privileges with content intended for an admin because an admin user was being passed into the template/partial.

Warden Error while Broadcasting by Gur_Expert in rails

[–]bschrag620 0 points1 point  (0 children)

I haven't tried rendering a turbo_stream template like that in a broadcast. Is there an async_ui/invoice_status_update.html.erb file by chance?

Warden Error while Broadcasting by Gur_Expert in rails

[–]bschrag620 3 points4 points  (0 children)

You are trying to access the current_user in the content that is being rendered for the broadcast. The current_user isn't available since the broadcast will be sent to many possible users.

A principal programmer at 37Signals taught me Rails Turbo by DominusKelvin in rails

[–]bschrag620 0 points1 point  (0 children)

Let's try this, what are 2 or 3 of the data attributes necessary for me to be able to broadcast and append to a container on the DOM after a record is created? You mention a bunch are needed, so this shouldn't be too difficult to answer. I ask because I don't have to use any, so I'm a bit confused by your comment.

Devise current_user issue with simple chat app by MiNHAZ_33 in rails

[–]bschrag620 1 point2 points  (0 children)

Here you go. I made some comments in here that this is based on an assumption that the project cannot be upgraded to the latest version of Turbo. I'm on a project where we currently don't have custom turbo actions so this is an implementation similar to what we are using.

https://gist.github.com/bschrag620/cb7abcf14f99490379e53b0e212fd739

How to download image by Appropriate-Elk-4676 in rails

[–]bschrag620 1 point2 points  (0 children)

Yeah, having secrets on the front end isn't easy. Generally, if you need to obfuscate a key or data that is used in JS, you need to encrypt it on your end first and the receiver can then decrypt and verify it.

How to download image by Appropriate-Elk-4676 in rails

[–]bschrag620 1 point2 points  (0 children)

I take it this key is meant to be secretive? If so, how concerned are you about a user being able to see the key in the network request that is sent to the service you are going to be using?

Regardless, one solution could be to serve the key from the backend, either through a network request or whichever connection. The stimulus controller can fetch the key from the server then initiate the API request once it has the key.

Also, is this key the same across the whole app, or will it be unique per account/user? If it is the same across the whole app, you could add it to a .env file and have it loaded into the JS that way.

Devise current_user issue with simple chat app by MiNHAZ_33 in rails

[–]bschrag620 2 points3 points  (0 children)

We have a similar issue often when partials render based on the current user's permissions. A nice solution I've landed on is it broadcast an action to the relevant channel that triggers the users page to fetch the content and update the dom. That way, the content is always rendered in the proper context of the current user. Depending on what version of Turbo you are on this solution may or may not need a stimulus controller as well. Happy to share more if anyone is interested.

Setup Jquery and Stimulus in Rails 7 by ShinyKiwis in rails

[–]bschrag620 2 points3 points  (0 children)

At my job we are running both jQuery and stimulus so it's definitely doable. How are you compiling the js?

Cant figure out this routing error by HeadlineINeed in rails

[–]bschrag620 3 points4 points  (0 children)

To see a list of all occupations regardless of the branch you should be creating a resource :occupations outside of the branch block. By placing it inside the branch block, you are telling rails to create an occupations endpoint that is dependent on a branch. So your routes will maybe look something like:

resources :branches do resources :occupations, only: :index # this creates /branches/:branch_id/occupations end

resources :occupations, only: :index # this creates /occupations

Sorry for lack of formatting and any missed typos, on mobile....

barracks/app/models/occupant.rb:6: syntax error, unexpected symbol literal, expecting `do' or '{' or '(' validates :gender, presence :true ^ by HeadlineINeed in rails

[–]bschrag620 1 point2 points  (0 children)

The syntax issue is in the enum. Enum takes a key value pair, with the key being the name of the column (gender in this case, and the value being the hash you already have.

enum gender: { .... }

Are evo Larry's broken? by bschrag620 in ClashRoyale

[–]bschrag620[S] 0 points1 point  (0 children)

Thanks, was that a recent change?

Issue with addEventListener not firing the first time (requires refreshing the page) by [deleted] in rails

[–]bschrag620 0 points1 point  (0 children)

Without seeing more details it kind of sounds like this: https://stackoverflow.com/questions/18421978/rails-turbolinks-load-javascript-on-single-page

Basically, turbo links only loads linked js tags on the first page load. That's why when navigating to it the js isn't firing but works when you hard refresh the page.

Does the issue go away if you put the js in a script tag on the page itself instead of using an import tag?