|
Yeah, Heroku is almost 0 effort and there are sooooooooo many guides on how to set it up. You can even have heroku deploy automatically when you merge to a branch (eg merge to master). It's really quite nice.
|
# ? Jul 28, 2021 16:36 |
|
|
# ? Jun 13, 2024 04:15 |
|
I'm working on a solo project using Rails with Docker, deploying to Heroku, mostly so I can get my feet wet with containers. My dev setup is basically having rvm and whatnot running natively on my Mac so I can run bundle and yarn to set up dependencies there, but only having a database instance inside my local container setup and only running tests and my dev server that way. I have no idea if this is a good way to do things. Any wisdom to share on developing locally with Docker?
Steely Dad fucked around with this message at 17:29 on Jul 28, 2021 |
# ? Jul 28, 2021 17:24 |
|
Steely Dad posted:I'm working on a solo project using Rails with Docker, deploying to Heroku, mostly so I can get my feet wet with containers. My dev setup is basically having rvm and whatnot running natively on my Mac so I can run bundle and yarn to set up dependencies there, but only having a database instance inside my local container setup and only running tests and my dev server that way. I have no idea if this is a good way to do things. Any wisdom to share on developing locally with Docker? Totally a valid setup. Docker desktop has a beta feature available for development containers. VSCode can connect straight into those containers. You don't actually have to have any natively installed dependencies, it can all be in docker. See more here: https://docs.docker.com/desktop/dev-environments/
|
# ? Jul 28, 2021 17:42 |
|
kayakyakr posted:Totally a valid setup. Docker desktop has a beta feature available for development containers. VSCode can connect straight into those containers. You don't actually have to have any natively installed dependencies, it can all be in docker. So I can have the same dev environment for my hobby projects no matter which PC I develop on WITHOUT any hassle to make sure I set them up the same? That's awesome.
|
# ? Jul 28, 2021 17:47 |
is docker sync still a thing
|
|
# ? Jul 28, 2021 18:22 |
|
A MIRACLE posted:is docker sync still a thing Not really. Development containers makes it entirely pointless, as you can now develop directly on a docker container without having to sync local code to container code.
|
# ? Jul 28, 2021 18:32 |
I would love some more info on that... Still using docker sync on an old project and it sucks. I have to restart it constantly because it won't pick up big version changes like files being removed etc. Or it just, forgets that it's supposed to be running sometimes and I'll be racking my brain trying to figure out why the build is wonky. Big rails 4 codebase via docker-compose on a Mac edit, maybe using the nfsmount volume..? I'm gonna try some stuff today A MIRACLE fucked around with this message at 19:43 on Jul 28, 2021 |
|
# ? Jul 28, 2021 18:42 |
|
I'm running an API server with rails. Calls to the server are made from app.mysite.com and mysite.com. The api runs from api.mysite.com I've installed rack-cors and have the following config in my initializer: code:
quote:The 'Access-Control-Allow-Origin' header has a value 'https://app.mysite.com' that is not equal to the supplied origin. I've tried replacing the origins array with a regex: code:
The only way I can successfully make the API calls from mysite.com is if I remove the subdomain references from the origins array completely. I'm assuming I've misunderstood something fundamental about how rack-cors works. Does anyone have any ideas?
|
# ? Oct 21, 2021 22:02 |
|
I wonder if it could be a http/https thing. Is your local server http?
|
# ? Oct 24, 2021 22:50 |
|
You need the [url]https://[/url] included. I’m not 100% but without it my work for [url]http://[/url] (and seems like it did if it was working locally)
|
# ? Oct 24, 2021 23:53 |
|
Gmaz posted:I wonder if it could be a http/https thing. Is your local server http? Gmaz posted:I wonder if it could be a http/https thing. Is your local server http? Thanks guys. I finally got to the bottom of it. Chrome was caching the first Access-Control-Allow-Origin header, so whichever domain I made the first call from was stopping the second domain working. Looks like it was working locally because my local server wasn't including an ETag header, so no caching.
|
# ? Oct 26, 2021 14:16 |
|
Anyone have an idea how to test whether null_session protection did something or not? https://github.com/rails/rails/pull/43760
|
# ? Dec 3, 2021 16:32 |
Hey y'all. I'm working on a rails app for the first time in a while, trying to remember how eager loading works while writing a map / serializer json thingy and hitting mad N+1 queries on it here's a really contrived example of what I'm trying to do Ruby code:
Ruby code:
edit... it seems like doing eager loading inside a scope doesn't work. invoking includes it outside a named scope works fine edit, I'm actually just doing it wrong A MIRACLE fucked around with this message at 23:26 on Apr 20, 2022 |
|
# ? Apr 20, 2022 22:56 |
|
Ruby code:
|
# ? Apr 26, 2022 23:54 |
|
If you literally want just the external_reference_id and nothing else, pluck is better than select, so you don't have to hydrate the whole tree of objects.
|
# ? Apr 27, 2022 10:43 |
Is there a general Ruby thread, or is this the closest thing? The Y of my personal X-Y problem is "I'm trying to maintain Gitlab on FreeBSD, and Gitlab is a massive Ruby app and it isn't properly supported on FreeBSD except by one German guy who writes docs that don't quite work and doesn't reply to email". Specifically I'm trying to run database migrations, and the rake command is failing because of missing gems, but I suspect they're missing because the maintainer guy didn't build the package properly, but again, he's not responding to email. Does any kind goon have any experience in this sort of area?
|
|
# ? May 19, 2022 16:26 |
post the error youre getting
|
|
# ? May 19, 2022 16:29 |
I mean .. it's not a specific error, it's more like "does anyone have deep knowledge in reverse-engineering Gitlab and its database migrations". The upgrade documentation I was following is here https://gitlab.fechner.net/mfechner/Gitlab-docu/blob/master/update/14.9-14.10-freebsd.md but it hasn't been responding for a few days, which is a great sign. This is the page on Gitlab's docs that describes dealing with stuck batched migrations: https://docs.gitlab.com/ee/user/admin_area/monitoring/background_migrations.html#manually-finishing-a-batched-background-migration but it isn't directly applicable to FreeBSD (the docs from the mfechner site talked about "rake" instead of "gitlab-rake", etc). I no longer have the commands in my history to try to rerun them and I can't do it from memory, but I was getting stuff like: code:
Anyway Which I "solved" by installing the FreeBSD package of rubygem-rspec and manually adding that require statement; but then So, yeah. What it all comes down to is that I feel like I'm the only person who's ever attempted this particular thing and everyone who could possibly help has vanished off the earth.
|
|
# ? May 19, 2022 16:52 |
|
That person's gitlab is down so I don't know what they're doing. Definitely sounds like you're missing some gem. If you could check the changes in the version you had to the version you're upgrading to, for Gitlab itself and this package, you could narrow it down.
|
# ? May 20, 2022 03:36 |
Oh hooray, their site is finally back up: https://gitlab.fechner.net/mfechner/Gitlab-docu/blob/master/update/14.9-14.10-freebsd.md
|
|
# ? May 27, 2022 11:40 |
|
Man. I've never had a really close look at Gitlab, but poking around it, its pretty loving good. Especially since Redmine feels so archaic these days.
|
# ? Jun 17, 2022 03:15 |
The background migrations finally worked fwiw, after I waited for 15.0 to be packaged and ported and it fixed the stupid dependency issues. But yeah, Gitlab is a staple at like three recent jobs, and now I have my own!
|
|
# ? Jun 17, 2022 03:22 |
|
That's good. Yeah, I ran Gitlab & CI Runner servers for my old job. Migrated em off a bare ssh only gitolite + trello + no CI at all to that and it was a huge win. Just used the omnibus package on an ubuntu lts vps and it rarely fussed. I'm sure plenty of sysadmins balk at that thing spawning a dozen different services, but it did Just Work.
|
# ? Jun 17, 2022 06:43 |
|
Is there a way to skip a file in the public directory? Basically, I'm serving a react app from public/index.html which works great. In development, though I'd like requests to hit my rails controller instead (so I can proxy the request to my local npm development server). The trouble I'm having is if the index.html file exists in public then rails just automatically serves that and never touches the controller. It's not a huge issue since I can just rename or delete the index file in development, but at some point I'm inevitably going to forget to add it back and push to live without it. edit nevermind config.public_file_server.enabled = false is what I wanted Tea Bone fucked around with this message at 16:46 on Jun 30, 2022 |
# ? Jun 30, 2022 16:39 |
|
Maybe I am going crazy, but didn't the rails scaffold generator also create locale entries for you too? ...or maybe I programmed that myself and forgot?
|
# ? Jan 2, 2023 21:46 |
|
KoRMaK posted:Maybe I am going crazy, but didn't the rails scaffold generator also create locale entries for you too? I don't recall anything like this
|
# ? Jan 3, 2023 17:12 |
|
I'm using the new delegated types feature in rails, and it seems interesting and functional, but I'm thinking about how we basically have two model objects for a single conceptual object now, and what to do about it. I was wondering if anyone else had any thoughts. To use the example from the documentation: code:
code:
What happens when you want to retrieve a bunch of entries for something else, though? You get a collection of entries, each with an attached entryable object. You can access its associated entryable object to call methods and retrieve attributes from it, but you need to remember that the indirection is necessary. I've read some suggestions to delegate appropriate method calls on the Entry model to its entryable object, at least for methods defined in every delegated class, but I guess I'm a little surprised that something like that isn't baked into the mechanism. And what about when you just retrieve a bunch of messages directly, without any comments, and without going through the Entry model? You have collection of messages, each with its associated entry object. But much, if not most, of the data for that message is actually on its entry object. So as you process your messages, you have an indirection issue to remember here, too. You could have the message model delegate the entry-related calls back to the entry, but it seems to me like an anti-pattern to have two classes where each is delegating to the other*. Maybe the answer is to access messages and comments strictly through Entry - Entry.messages.where(...) and Entry.comments.where(...) instead of Message.where(...) and Comment.where(...) - and always remember that you have an entry object, rather than the associated delegated class. That probably works fine, but it seems unsatisfying to me. I guess my problem is that with all of this boilerplate, I should be able to treat the entry-entryable pair as a single logical object in the code. Otherwise, I'm not really gaining a lot over hand-rolling a solution. Another issue that has come up is with has_many, through relationships with the delegated classes. code:
I could add a many-to-many relationship directly between user and messages (and comments), and maybe that's the right answer, but then I either have to restructure some code that already uses the user-entry link (since I'm adding this to an existing project), or I have duplicate connections between each user and its messages (and comments), and have increased the potential for a data mismatch. I don't know, I guess I just feel like this feature isn't quite ready for prime time, and that it should offer a little more convenience, or at least more documentation setting best practices for how to think of the resulting pairs of objects (i.e. do we now approach this as a bunch of entries with some delegated objects attached, or a bunch of messages and comments, each with some entry details attached?) * Instead of delegation, I could use a method_missing method on one class telling it to go look at the other class before raising an exception, and that should be pretty equivalent.
|
# ? Mar 2, 2023 22:27 |
|
I used it at my previous job few years ago (we actually backported into our Rails 6 application, because 6.1 was not released yet). It has its wonky parts but IMO still beats STI. I remember rewriting a couple of models from STI to delegated types and it really helped with maintainability.quote:You could have the message model delegate the entry-related calls back to the entry, but it seems to me like an anti-pattern to have two classes where each is delegating to the other*. quote:Instead of delegation, I could use a method_missing method on one class telling it to go look at the other class before raising an exception, and that should be pretty equivalent. quote:how to think of the resulting pairs of objects (i.e. do we now approach this as a bunch of entries with some delegated objects attached, or a bunch of messages and comments, each with some entry details attached?) Gmaz fucked around with this message at 16:25 on Mar 3, 2023 |
# ? Mar 3, 2023 16:09 |
|
Thanks for your feedback. It's nice to have some confirmation at least that I'm not missing something easy and obvious.Gmaz posted:If I looked at it from the second approach then I would probably keep the models separated and create custom objects when I need to combine data. Could you expand on what you mean by this, exactly? Do you mean you wouldn't use the delegated types construct at all, and just use regular composition, or you'd create another, separate class for handling merged entries and entryables?
|
# ? Mar 6, 2023 02:57 |
|
Yeah, in that case I wouldn't use the delegated type at all. Usually this happens when data that's coming from a few models has some common attributes and needs to be presented in a combined way. In that case I'd use View objects, Presenters etc. whatever you want to call the pattern.
|
# ? Mar 9, 2023 21:47 |
I have a service that is returning multiple headers with the same name and Faraday only adds one header to the response_headers per name. So it's keeping the first header and dropped the rest of them. guess I can try this in Net::HTTP
|
|
# ? May 31, 2023 23:09 |
|
That sounds like it would suck for setting multiple cookies, weird.
|
# ? May 31, 2023 23:42 |
I’m open to suggestions. I dug pretty deep into the gem with my debugger and can’t figure out a good place to monkey patch it. Or if I am doing it wrong. Was hoping to get it working in faraday cause I already built a whole library around it
A MIRACLE fucked around with this message at 00:34 on Jun 1, 2023 |
|
# ? Jun 1, 2023 00:30 |
|
Is it merging them down to a single one with commas? https://github.com/lostisland/faraday/issues/1120
|
# ? Jun 3, 2023 08:08 |
|
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.
|
# ? Oct 7, 2023 16:24 |
|
I've been using Rails on the backend for the last 10 years and would prefer to keep doing it. But it is somewhat limiting in that most similar webdev jobs seem to have node backends these days for some godawful reason. I don't think it merits deleting from your resume though?
|
# ? Oct 7, 2023 17:12 |
|
Why would you delete it from your resume even if you switch languages? At least for me experience is much broader than just using a programming language/framework, and a lot of concepts in software engineering are very much transferable. As for Rails itself, it's been proclaimed dead for the last 7-8 years but I still see it kicking and new projects/startups being built with it, along with a couple of giants like Github and Shopify. If you like the framework and feel comfortable working with it, I see no reason to switch.
|
# ? Oct 7, 2023 17:16 |
|
i use computer to get things done. rails is great for getting stuff done.
|
# ? Oct 7, 2023 17:38 |
I’m still doing rails and making good money at it. Node is good to know too, you can even cross over to .net if you want
|
|
# ? Oct 7, 2023 17:43 |
|
|
# ? Jun 13, 2024 04:15 |
|
Sivart13 posted:I don't think it merits deleting from your resume though? the problem with having it on my resume is i keep ending up in rails jobs. at my last job i joined as a frontend React dev but then it turned out i knew more about Rails than the backend team. 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" but i ran `rails new` for the first time in a long time last weekend and it is still an unbelievably fast way to build out ideas. where it choked for me was when i needed some stuff that React is good at, like a combobox. I've been doing Rails backend + React frontend for a long time but the call of the full on monolith is still quite appealing, especially with the growth of HTMX and everything talking about HATEOS and so on.
|
# ? Oct 7, 2023 17:54 |