Hacker Newsnew | past | comments | ask | show | jobs | submit | adamzapasnik's commentslogin

This is what I struggle a lot with in Rails.

No good, community backed serialisation gem. AMS is a mess, other ones are not maintained. And I'm not a fan of JSON api spec's serialisation either.

But also AR doesn't have any easy tools to construct complex queries/multi queries. It works for basic and medium stuff, but even this very common count problem is a disaster to deal with. Sure. you can use Arel and some other gems, but these aren't good solutions for someone that wants to get things done. Makes me wonder how others deal with these problems tbh.


IME if ActiveRecord is not sufficient, you go directly to SQL.

find_by_sql gives you enough freedom to get everything out of the db into a ActiveModel object.


bs, there are a few very good serialization gems. ActiveRecord and Hibernate/JPA work a lot better than concatenating your own SQL strings.

If there's something that really doesn't benefit from your model (reports), then you'd fallback to either SQL, or still use ActiveModel + the aggregates


Please list the good serialisation gems, as I can't find any ;)

What if you have a complex/dynamic query, how do you build it? You said yourself that AR works better than concatenating SQL strings, but AR doesn't even support CTEs atm and building complex queries is not trivial and sometimes even possible without just SQL strings...


Big fan of raw sql, but practically speaking (as it relates to developing with rails) CTEs can be rewritten as subqueries, the advantage being that they are linear instead of nested in SQL.

With AR queries you can do the same and make it linear in ruby (and then the computer doesn't really care if your sql is nested)

    last_three_posts = Post.limit(3).order(created_at: :desc)
    @posts = Comment.where(post_id: last_three_posts)


It's not perfect or painless but I think jsonapi-serializer is pretty good


I love it, playing it on repeat on Spotify, thanks for sharing!


That's cool. There are a few of them already, what makes this one different?

Gonna share a link to my Elixir related project (formatter for .html.l?eex files) that readers will probably find useful. https://github.com/adamzapasnik/prettier-plugin-eex


Nice! does it work with .leex files for LiveView, or templates inside a LiveView .ex module? That's the biggest small issue I'm running into day to day.


It should work with .leex files. About the .ex files, I would be surprised if it worked. I do have it in mind, though. Actually, gonna add Issue to repo, so I wouldn't forget :)


I had to move to 4days week due to covid. Must say that, unexpectedly, it was very good experience. It felt almost like 50/50 work/free days. I was more focused at work. I was more productive. Although, honestly, I don't think I was able to deliver same output as 5days week. The way I see it, you have only a few hours per day where your output is at the highest level. When you cut off 1 day you also decrease that hours. You can't just squeeze them into other days, because it doesn't work like that.

I actually learnt two lessons:

4 days a week is something I'm looking forward when I have a profitable side project.

5 days x 6 hours imo is better than 5 x 8 hours, better to be less tired and maximize next day's most productive hours than to be tired and burn out eventually


I'm actually amazed by the progress. Wow. Seems like it's worth keeping an eye on. Curious if anyone is running it in production yet?


The things I've been missing in software development are:

- some kind of manual labour or any kind of movement, sitting at a desk all time is boring and unhealthy

- some kind of social interactions, I don't count tech-talking as one


I don't get what is the big problem. Just turn off the disturbing Cop. It's a linter not an AI-Linter to know what is expected.

I don't even think that this is RuboCop's fault but Ruby's. Because you can write said code in a lot of different ways (like shown in the post).


> I don't even think that this is RuboCop's fault but Ruby's. Because you can write said code in a lot of different ways (like shown in the post).

Honestly, the problem is that rubocop was not designed by a community of experts. It started as the opinions of a singular person, one motivated to the point of writing a linter where none existed. As a result, it's heavily opinionated on trivial shit. Yes, you can configure it, but the out-of-box experience is overbearing.

I generally prefer https://relaxed.ruby.style which is ... a lot more chill.


Exactly - you don't even need to turn it off globally, just add the magic comment and then an explanation for why you are being explicit about returning nil. ezpz


The thing that you can write said code in a lot of different ways is not a fault but a feature for which Ruby is loved by many. As can be also seen from the article it lets a programmer to be neatly expressive in various different situations.

Now if you personally don't like this feature you should probably use a language which feature is that you can write a thing only in one way and no other.


I think there are two reasons:

- you can copy the classes from html directly into @apply (you need to tinker a bit more to get responsive/hover/etc classes to work, though)

- you work with predefined values, so if you switch color in tailwind.config.js, it's gonna get correct value in the @apply class too.

That's the way I see it


2. which values are you going to ever change in align-center, display-flex and text-color-white, it's not like you will change the display flex to mean display block or align center to mean align start, it will always be the same. Same with color white and 95% of other classes that tailwind uses.


For the second one, couldn’t you get the same effect by just using css variables?


Sure you can and you should, right?

But this way you have to write couple of classes more, couple of variables more. And with Tailwind you just define/change value in the config and you have all the classes generated, so the changes are minimal.


I think a lot of people are missing the point. That could be attributed to the poor title, though.

The way I see it, pre-phone their daughter was probably much more engaged with her parents and was doing more manual creative stuff. After the phone appeared, she distanced herself and got absorbed by it.

I don't get why so many people here are trying to defend smartphones/social media?

Isn't it pretty obvious they are addictive? And to a young kid, that doesn't know any better, it can get really bad.


Agreed that these can be bad (my kids have some socials but I keep an eye on them and have lots of talks about pitfalls to avoid), but for the sake of argument I can't help pointing out that what you're describing is a normal process of individuation that teens all go through.

Social attention focused inward toward family --> Social attention turning outward towards others + establishing an identity apart from that of the family. This is totally normal.


Some apps are addictive, not all of them. The biggest problem IMO is that "no phone" isn't an option. Kids need a phone to participate in society. That's just the way it is. The problem I see is that phones have super addictive apps like TikTok that target young kids, so giving them the "good half" of a phone means you also end up giving them the "bad half" and kids aren't good at understanding why the bad half is bad for them.

It's like serving a kid a plate of food with vegetables and meth side-by-side and the meth dealer is making every effort they can to push the meth into the vegetables.


Is being addicted to creating tiktkok/instagram content to get likes such a bad thing? The fight to stand out on those social networks forces you to be creative.


I'd argue that the fight to stand out on these networks forces you, rather, into a low-level depression.


Its the job of the parent to set limits.


Half screen? I see a comment or two. I think it's normal/human thing to have discussions in comments like this one. Especially, when it's an exit related topic that gets shared on startup/VC related forum-site like this one?

Prefer just "good job" comments, or what?


I agree. I read all the comments in this thread and this time and the negativity isn't there. It just doesn't exist. I don't know if those comments were removed, but I just suspect they never existed.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: