Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
KoRMaK
Jul 31, 2012



what was the deficiency regarding the combo box?


are there generators for rails that spit out react/typescript front ends?

Adbot
ADBOT LOVES YOU

prom candy
Dec 16, 2005

Only I may dance

KoRMaK posted:

what was the deficiency regarding the combo box?

Stimulus is worse than react or other state based js tools basically, and the smaller community means you're not as likely to find premade stuff. But I think maybe mounting react components for that stuff inside a mostly server-driven frontend could work.

The other thing that sucks but is maybe solvable is some of the tooling. Like with a react component when I hit save it fires off prettier, and if prettier doesn't do its thing I know my markup is invalid. Couldn't get that working for erb templates. Maybe slim or haml is the answer there. I've basically been out of the loop on frontend rails for the last 6 years or so.

wolfman101
Feb 8, 2004

PCXL Fanboy

prom candy posted:

Anyone out there still using Rails? I can't decide if I want to double down on my almost 20 years of experience with it and just ride out the rest of my career as a Rails expert or if I should delete it from my resume. It seems like there's lots of lucrative opportunities working on and modernizing legacy Rails apps but at the same time working on legacy Rails apps can be hell.

My employer is just now starting a new Rails application to replace a dotnet application. Ruby is still growing, just not as fast as *insert latest fad*.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

We still run the world’s biggest Rails app, I think. Good stuff, though I really need to learn it better.

KoRMaK
Jul 31, 2012



if you don't want a monolith, just make an eco system of tinier rails apps, right?

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

oh I very much want a monolith in terms of the software architecture, even if we deploy it “unevenly” for routes that get different traffic levels

Black Friday/Cyber Monday should put up some good numbers this year, especially with YJIT coming along so nicely

Less Fat Luke
May 23, 2003

Exciting Lemon
Nice, I used to work there. I remember arguing with the CTO in my last few months because he was insisting we would never use "microservices" and I showed him my dev environment with not only the core monolith but like 18 other services necessary for the feature I was working on (money related which made it far worse); he was kinda furious about how everyone stealthed into services but like holy poo poo that monolith was brutal to work with in the pre-Spin days.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Spin still hurts a bit, but not as much as running 200 services with slightly different conventions. You can still reliably rile up the CEO by suggesting a microservice for something.

dev up will work for me some day, but today is not the day.

Gmaz
Apr 3, 2011

New DLC for Aoe2 is out: Dynasties of India

quote:

after getting into typescript i was kinda like "gently caress this i'm sick of all the indirection of rails I don't want to do this anymore"
Funny, that's how I feel about our current React (TS) setup at work and not Rails. Between auto generated types from BE to FE, all the libraries for tables/forms, our own hacks built over the top of those libraries and the interdependence between different libraries it's really complex and counter intuitive to figure out a flow of data. Like something as simple as a table, I have to go to through 5 files to figure where the data is coming from and how it's setup. You want do something that would be trivial in plain old HTML? gently caress you! Type checker is nice, but often times it just gets in the way with indecipherable errors that are usually about simple and inconsequential things.

Comparing that and when I work on the Rails part off the app is night and day in terms of ease work and productivity in general. Now I thought it's just due to me being more experienced with Rails, but internal polls in the company (100+ devs) say pretty much the same. People are in general happy with the BE part, but frustrated with FE. Of course it could be due to our setup and React could be a joy to work with in other circumstances but it sure doesn't feel that way to me. From what I heard of Node projects it's not much better. A bunch glued on libraries, that end up looking like a frankenstein Rails anyway but without the standards to quickly figure out a way around.

Gmaz fucked around with this message at 09:42 on Oct 8, 2023

prom candy
Dec 16, 2005

Only I may dance

Gmaz posted:

Funny, that's how I feel about our current React (TS) setup at work and not Rails. Between auto generated types from BE to FE, all the libraries for tables/forms, our own hacks built over the top of those libraries and the interdependence between different libraries it's really complex and counter intuitive to figure out a flow of data. Like something as simple as a table, I have to go to through 5 files to figure where the data is coming from and how it's setup. You want do something that would be trivial in plain old HTML? gently caress you! Type checker is nice, but often times it just gets in the way with indecipherable errors that are usually about simple and inconsequential things.

Comparing that and when I work on the Rails part off the app is night and day in terms of ease work and productivity in general. Now I thought it's just due to me being more experienced with Rails, but internal polls in the company (100+ devs) say pretty much the same. People are in general happy with the BE part, but frustrated with FE. Of course it could be due to our setup and React could be a joy to work with in other circumstances but it sure doesn't feel that way to me. From what I heard of Node projects it's not much better. A bunch glued on libraries, that end up looking like a frankenstein Rails anyway but without the standards to quickly figure out a way around.

The thing I like about TS is the way everything is explicitly imported, meaning you can always easily follow the thread of "where is this defined?" It's still absolutely possible to build layers upon layers of bullshit like you describe, but at least there's a thread to follow. Meanwhile even when running the Ruby LSP in VSCode because of inheritance and mixins and so many global contexts you can occasionally command click on a symbol and it just goes :shrug:

This is especially annoying if you wind up on a project where people decided to solve the fat model problem by just splitting the model's methods into various concerns (one of Rails' absolute biggest mistakes imo) meaning the actual implementation of the class is now broken up into a bunch of different files and because there are no actual hard boundaries they're probably all reliant on one another.

There's no avoiding playing code detective when you're working on established systems but in Rails I find it can be a lot more frustrating than TS.

kayakyakr
Feb 16, 2004

Kayak is true
I've fully swapped over to TS on the whole stack for my own stuff. Between Next and Remix, it's just as straightforward for me to get going there as it is in Rails.

I still like rails, but Remix is just as easy.

TheRevTastic
Jan 15, 2012
I'm the opposite. I started off with JS/TS for all of my own stuff (and professionally) but I just recently in the past month or so started to swap over to Rails for anything I'm making now.

Once I got past the magic of Rails I have been able to build out an MVP for a personal workout app faster than I would have in either NestJS or Elsyia and have found Turbo to be a really nice feature.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

turbo is cool. I haven't gotten to the "stimulus" part of "hotwire" yet. is all this really better than doing a create-react-app ?

Pardot posted:

Is it merging them down to a single one with commas? https://github.com/lostisland/faraday/issues/1120

sorry didn't reply before but I was having trouble getting at any value in the list after the first one. and I would have been happy to split it myself but I couldn't find a way to get at a raw header value either.. I haven't had to page through okta api user lists since then but I am going to have get it working on the library sooner than later lol.

might have to use the standard http lib for that request. but theres a company policy (a policy I made up) to not use other http libraries than faraday lmao. standard lib doesn't count

A MIRACLE fucked around with this message at 06:23 on Nov 19, 2023

Sivart13
May 18, 2003
I have neglected to come up with a clever title
I'm just now leaving a 6 year stretch in pure Rails server side development for a JS/TS job.

I've avoided learning any of the Hotwire stuff because we only had a very limited amount of interactivity required and it was doable with JS/jQuery stuff.

When I look at descriptions of Hotwire technologies, it makes sense to a point, but "turbo streams" are they start to lose me and then stimulus is a Whole Thing.

The Stimulus example on that page looks nasty in that you gotta learn a whole funky grammar that wouldn't translate to any other framework. Maybe there are advantages over Doing A React, but I would have to see a more complicated example to know how far it can be pushed with this syntax.

They say it's only for "interactions that are relatively small" -- I presume you couldn't use Stimulus to implement something like a drag-drop list that persisted back to the server on every drop?

enki42
Jun 11, 2001
#ATMLIVESMATTER

Put this Nazi-lover on ignore immediately!

A MIRACLE posted:

turbo is cool. I haven't gotten to the "stimulus" part of "hotwire" yet. is all this really better than doing a create-react-app ?

It really depends, they are different tools for different use cases. A react SPA is definitely going to be a better fit for highly interactive applications, if you were making something that looked like Google Maps, or Figma, or anything else where most interactions don't really feel like navigating pages, that's going to be a pain in the rear end with "vanilla" Rails even with all the Hotwire stuff.

If your app feels like navigating between pages primarily and has smaller bits of interaction sprinkled in, and especially if you're not working on a team that splits into front-end and back-end developers, you'll be way more productive with Rails.

There's honestly not that much to Stimulus and more and more I find that you can often do things more effectively with Turbo. Any stimulus controller that communicates with the backend is a smell IMO.

prom candy
Dec 16, 2005

Only I may dance
I played with Stimulus a little bit and I really didn't like it. I think I'd probably go for something like Alpine if I needed the "JS sprinkles" approach but I'd honestly rather just use React.

enki42
Jun 11, 2001
#ATMLIVESMATTER

Put this Nazi-lover on ignore immediately!
Yeah, it's definitely one part of Hotwire that you can take or leave, it doesn't really tie into the other stuff much at all.

I can't imagine heavy use of React and Turbo playing nice together though. React generally wants to control the DOM of anything it's mounted on and have JS fully control what the user sees, and Turbo is built around the server generating HTML and adding that to the DOM so they're pretty fundamentally different approaches.

prom candy
Dec 16, 2005

Only I may dance

enki42 posted:

Yeah, it's definitely one part of Hotwire that you can take or leave, it doesn't really tie into the other stuff much at all.

I can't imagine heavy use of React and Turbo playing nice together though. React generally wants to control the DOM of anything it's mounted on and have JS fully control what the user sees, and Turbo is built around the server generating HTML and adding that to the DOM so they're pretty fundamentally different approaches.

I think if I was going all in on Rails I would maybe use React just for specifically complex UIs and turbo for other stuff. Last month I was posting about coming home to Rails but after spending more time with it I think I'm just going to be starting new full-stack projects with Remix. The nice parts of Rails are really nice but ultimately I just like working in TypeScript that much better.

Edit: All that said I'm working on a legacy Rails project with jQuery today and I can see why people who skipped out on going full JS find Stimulus pretty nice to work with. It's a big jump over this nonsense.

prom candy fucked around with this message at 23:06 on Nov 20, 2023

enki42
Jun 11, 2001
#ATMLIVESMATTER

Put this Nazi-lover on ignore immediately!
Yeah, that's definitely possible, and can work. Where I've found it falls flat is when dealing with forms and submitting data to the server. Rails really wants to use a traditional HTML form, and React really wants to do server interaction via fetch. It's possible to make either do the unnatural thing, but you miss out on a lot of tooling and hit some sharp edges. But I used React to build a media player in an otherwise JS light Rails app and it worked great.

I like Stimulus but I agree when I try to do something complicated with it I want to use React. It's good for the "once in a blue moon I will want to write 30 lines of Javascript for a particular interaction" but if it's more than that it's painful.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Applied to a job at <popular rails hosting company> and got a form response rejection. Not even an HR screen? Maybe I’m slipping..

Steely Dad
Jul 29, 2006



I want to obfuscate IDs in my URLs without having to either change my primary key types or add slug attributes to my models and use those. In the past, I've used the hashid gem for this and it worked well, but I see it hasn't been maintained in 4 years. Anybody else know of an actively maintained gem they like for this purpose?

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


Steely Dad posted:

I want to obfuscate IDs in my URLs without having to either change my primary key types or add slug attributes to my models and use those. In the past, I've used the hashid gem for this and it worked well, but I see it hasn't been maintained in 4 years. Anybody else know of an actively maintained gem they like for this purpose?

from that link it looks like they renamed the project to "sqids", which is maintained

prom candy
Dec 16, 2005

Only I may dance

Steely Dad posted:

I want to obfuscate IDs in my URLs without having to either change my primary key types or add slug attributes to my models and use those. In the past, I've used the hashid gem for this and it worked well, but I see it hasn't been maintained in 4 years. Anybody else know of an actively maintained gem they like for this purpose?

https://github.com/excid3/prefixed_ids

Steely Dad
Jul 29, 2006




Perfect, and I'm already using Jumpstart. Thanks!

KoRMaK
Jul 31, 2012



what about signed global ids?
https://github.com/rails/globalid#signed-global-ids

Steely Dad
Jul 29, 2006



Interesting! Hadn't seen those before. I think I'm leaning towards the simplicity of excid3's gem, but it's good to know about this one, too.

prom candy
Dec 16, 2005

Only I may dance

Steely Dad posted:

Perfect, and I'm already using Jumpstart. Thanks!

Nice! Haven't used this, I just happened to see it on twitter or something recently and thought it looked good.

Sub Par
Jul 18, 2001


Dinosaur Gum
I'm trying to do something that I feel should be easy but I'm clearly loving something basic up. I have a rails 7 app and I am trying to use a node package called TipTap in it, using these installation instructions.

I have run:
code:
npm install @tiptap/core @tiptap/pm @tiptap/starter-kit
And I've added
code:
import { Editor } from '@tiptap/core';
import StarterKit from '@tiptap/starter-kit';
At the top of the relevant stimulus controller. I've also precompiled my assets. But I have this annoying poo poo in the console:
code:
Failed to register controller: tiptap (controllers/tiptap_controller) TypeError: Failed to resolve module specifier "@tiptap/core". 
Relative references must start with either "/", "./", or "../".
If I load the js from TipTap's CDN it works, but I'd rather not do that. What am I forgetting to do? I'm for sure relying on too much Rails magic here without understanding the concepts at play (importmap, probably), but I can't find a good explanation of how to do this kind of thing. Every tutorial I read online is like "it's magic and you just type these things and it works", but it isn't working.

Edit: Motherfucker, just
code:
./bin/importmap pin @tiptap/core 
./bin/importmap pin @tiptap/starter-kit
and things work. At least I was right that I just didn't know enough about the Rails magic and importmaps.

Sub Par fucked around with this message at 18:07 on Jan 6, 2024

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

faraday is driving me up the wall today. it was decoding and re encoding my URL params in ways that are incompatible with the API i'm calling, so I thought, ok I will try writing a custom param encoder. which it is hitting but then not respecting at all. like why does it do this

Ruby code:
    class ParamsEncoder
      class << self
        def encode(params)
          encoded_params = []

          params.each do |k, v|
            encoded_param = ERB::Util.u(v)

            encoded_params << "#{k}=#{encoded_param}"
          end

          encoded_params.join('&') # at this point the params look good -> eg search=login%20eq%20%22myemail%40gmail.com%22
        end
then it makes the request with this URL instead??

code:
  HTTP GET (92.50ms)   REDACTED/api/v1/users?search=login eq "myemail@gmail.com"
edit, bleh of course as soon as I post this I realise its just the logger trying to make things more readable and the real issue is I'm using the api slightly wrong

A MIRACLE fucked around with this message at 18:53 on Feb 20, 2024

KoRMaK
Jul 31, 2012



I upgraded to rails 6 and this new console behavior is driving me up the wall - it has autocomplete and pager enabled. I've disabled autocomplete, but can't figure out how to disable the pager behavior. I added the following to my ~/.irbrc file. Is there a way to config this in the actual app rather than needing people to edit their irbrc file?

code:
IRB.conf[:USE_MULTILINE] = false
IRB.conf[:USE_SINGLELINE] = true
IRB.conf[:INSPECT_MODE] = :inspect

KoRMaK fucked around with this message at 18:49 on Mar 2, 2024

Adbot
ADBOT LOVES YOU

enki42
Jun 11, 2001
#ATMLIVESMATTER

Put this Nazi-lover on ignore immediately!
You could throw it in an initializer, and check if ::Rails::Console is defined:

code:
if defined?(::Rails::Console)
  IRB.conf[:USE_MULTILINE] = false
  IRB.conf[:USE_SINGLELINE] = true
  IRB.conf[:INSPECT_MODE] = :inspect
end

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply