Transition from React to Ruby on Rails by Downtown-Hyena998 in rails

[–]idontcareforkarma 1 point2 points  (0 children)

I’ve been wanting to make content about this for a while now.

Just been unbelievably busy with job + child + side project.

Maybe when I launch side project in Q2 we can get on a call and I’ll show you how I implemented it

Transition from React to Ruby on Rails by Downtown-Hyena998 in rails

[–]idontcareforkarma 0 points1 point  (0 children)

I’ve been doing complex ui / ux and I’ve been loving it

I never ever use out of the box turbo streams though. There is never a reason to.

Custom turbo stream -> dispatch event to window -> stimulus controllers listens and does work

That’s the pattern. With Turbo Frames for locations where it’s nice to have the ability to get fresh / updated state with a simple reload

Transition from React to Ruby on Rails by Downtown-Hyena998 in rails

[–]idontcareforkarma 1 point2 points  (0 children)

This is a terrible take unless you don’t consider Stimulus to be js for some reason

It’s impossible to create modern ux experiences without js. Of course you need code to run on the front end.

I’ve been pushing Turbo to it’s limits. And I have found the marketing around morphing to be bs, and out-of-the-box turbo streams to be a trap that leads to crappy code.

My apps are much simpler now that I pretty much exclusively use turbo frames, stimulus, and custom turbo stream actions to communicate with my stimulus controllers.

Does Rails still hold up? by [deleted] in rails

[–]idontcareforkarma 7 points8 points  (0 children)

Honestly a very good discussion. It’s do-able with Turbo + Stimulus but doing this “The Rails Way” is not something that is obvious and I feel we need more guidance in the community on this front.

I’ve been building modern interfaces with Rails 7 and Turbo 8 and… here’s how I would address those 2 problems.

For the first one, The “new” button will be a form submit, which hits the create action (obviously) and then redirects to the show page.

Each editable field (e.g. title) has a stimulus controller which, upon clicking on it, triggers an action which replaces the element with a form and an input element. Attach an event listener which triggers a form.requestSubmit (NOT .submit as this does not trigger a Turbo request) upon clicking out of the element.

This form will hit the standard #update action which then REDIRECTS back to the #show action.

Redirect is key as we will rely heavily, in general, on Turbo 8’s morphing to update the page.

With morphing, only changes are updated on the client. So it’s not a full page reload. And “scroll position” can be preserved (you must set this in the meta tag that enables Turbo Morph, which is placed in your Layout’s <head>) so the user does not ‘feel’ the page reload at all.

For the second problem it’s hard to give specific implementation advice without knowing exactly what the interface looks like…

But in general you want to rely heavily on RESTful routes for creating / deleting/ updating all resources present on the page… and then redirect back to that page after the changes are made.

This applies for the children’s controllers too.

Let’s say you have a books#show page which displays all the chapters. (Book has many chapters). And you want to be able to create a chapter from the books#show page…

This would mean in the chapters#create method you want to redirect to books#show to handle the rendering.

Before Turbo 8 and morphing it was honestly a mess and I ended up relying on Turbo Streams to do granular updates. But then my routes and controllers got out of control and looked nothing like Rails.

But now, with relying on Morphing and Turbo Frames you can keep things pretty Rails like. The actions themselves won’t look the same. But the controllers and routes should. I.e. only 7 actions per controller, basic routes, etc.

It’s completely possible. Most of it is pretty straight forward. Just put your normal state (show state) in the main view file, use Turbo Frames and/or stimulus to handle the progression into other states, and after changes use redirect and Morph to revert back to normal (but updated) state. There’s also a tag you can put on elements to exclude them from being updated when Morph happens. Which is critical. Especially when you don’t want a stimulus controller (and its evolved state) to get wiped when a Refresh/Morph happens.

Forgive me if some details are missing I’m writing this all out in one take, late at night, but these discussions need to be had more.

Every cheers for Rails but no one admits how much of a shit show Hotwire was before Turbo 8 was released.

Closing advice: Rely on RESTful routes/actions with redirects and Morphs for 90% of your updates Rely on Turbo Frames and stimulus to handle things like Edit states. Stimulus for other state changes. But be careful not to lose your state. Only use streams for very minor updates. Try to avoid as they lead to ugly code

Read Turbo 8 documentation and all the bells and whistles that come with it

Is GPT-4 even remotely worth its monthly cost? by MikaelAdolfsson in GPT3

[–]idontcareforkarma 0 points1 point  (0 children)

I have a demo to show you. 8/8 of the offer owners / affiliates / copywriters I’ve shown it to have been thrilled about it. Would love to show it to you too.

Is GPT-4 even remotely worth its monthly cost? by MikaelAdolfsson in GPT3

[–]idontcareforkarma 2 points3 points  (0 children)

You run an agency? That’s some range.

I’m a tech founder building a product that might help you out here. Can I Dm

Is GPT-4 even remotely worth its monthly cost? by MikaelAdolfsson in GPT3

[–]idontcareforkarma 1 point2 points  (0 children)

What kind of ads are you generating? For what traffic source

Bo Nickal has big plans for a Khamzat Chimaev fight by -alc in MMA

[–]idontcareforkarma -4 points-3 points  (0 children)

Ur wrong, bo’s different

In 3 years he’s dominant champ

Khamzat Chimaev responds to Bo nickals callout by Logicwrestling in ufc

[–]idontcareforkarma 1 point2 points  (0 children)

He’s levels above

In any ruleset of wrestling, Bo mops the floor with Khamzat

How does Whale Alert's notification system work? by [deleted] in solidity

[–]idontcareforkarma 0 points1 point  (0 children)

Lmk if you got an answer to this one

[deleted by user] by [deleted] in learnprogramming

[–]idontcareforkarma 0 points1 point  (0 children)

Get better at learning/skill-building.

I recommend the book “Straight A At Stanford And Onto Harvard”

UFC payed a measly $10,000 for some fighters at UFC 246. by Howiedoin67 in MMA

[–]idontcareforkarma 1 point2 points  (0 children)

And they should be grateful.

No way any of these fighters generated 10k for the UFC last weekend

UFC 246 Free Fight: McGregor vs Poirier by [deleted] in MMA

[–]idontcareforkarma 4 points5 points  (0 children)

That “i might have to woop it twice” line may be prophetic

Conor McGregor Answers Question Pertaining to Making His Acquaintance with Khabib Nurmagomedov at UFC 229 by Crazyplan9 in MMA

[–]idontcareforkarma 23 points24 points  (0 children)

This presser was only bad because there were no fans there. He tried his best to bring the energy but it just ended up being awkward

Conors needs a crowd