13 ms·
Rails Cheat Sheet
- deleted 3y ago[deleted]
- Bergrebell 3y agoThats a good point and nice to see that the rails community is starting to work to consider new engineers more. The whole JS and also PHP/Laravel ecosystem is doing this already since quite some time. Rails is still the best option imo when you want to be productive as a small team - but the learning resource don’t keep up with other frameworks/languages.
- avg_dev 3y agoi find this critique interesting, because i believe the initial momentum behind rails was sparked by a video about how to create a blog using rails without any setup in just a few minutes. https://www.youtube.com/watch?v=Gzj723LkRJY https://www.youtube.com/watch?v=Gzj723LkRJY
- bdcravens 3y agoAn almost 20 year old demo from the creator really doesn't address the issue of community resources. Any application of minimal complexity needs to solve problems that demo doesn't begin to address, and beginners need access to resources to guide them in solving those problems.
- bongobingo1 3y agoSome how nostalgic for those plain invert-colours buttons that rails used to have. Also DHH's iconic "whuups!" every 2 minutes is pretty funny to relive.
- lobstrosity420 3y agoAlso Railscasts.
- seattle_spring 3y agoNot to mention that Rails was the language-de-jour for most bootcamps between 2012 and 2017 or so. The problem was running into developers who only knew Rails, not finding ones that didn’t know it at all.
- kirso 3y agoThis is my biggest gripe. I am learning programmning as a hobby, I don't have much time in a day but like to allocate at least 1-2 hours to practice. When deciding on the language to learn, I really really wanted to go with Ruby and then transition to Rails. But it seems like educational materials are currently lacking, most of the tutorials on YouTube are outdated. When investing in eco-system, I never looked at the availability of jobs. But when comparing say JS/TS vs Ruby, there is clearly a viable route to learn it as a beginner. The downside is that there is a lot of trash and low quality materials as well as inhibited complexity - but after some time its not such a problem to sift through the noise.
- lylo 3y agoExpect this to change dramatically in the coming months with The Rails Foundation initiatives. Details here: https://rubyonrails.org/foundation https://rubyonrails.org/foundation
- gymbeaux 3y agoI always hear good things about Ruby on Rails, yet it remains relatively niche. I first heard about Ruby + Rails in 2013, and ten years later it seems to be just as niche. Loved by those who use it, but niche. Why does it continue to struggle in this way when more recent languages like Go are booming?
- 4pkjai 3y agoI think they lost a lot of growth because of the bad PR from Twitter. Twitter started with rails and constantly went down. Rails was blamed for the downtime, perhaps unfairly.
- CTmystery 3y agoThat's interesting. I remember having to defend my using ruby to other programmers around that time. I always loved it, and all the hate seemed to be centered around "it's too slow". No one ever brought up twitter being down, explicitly, that I can recall. Perhaps that's what they had in the back of their mind though? It's been a bit of a mystery to me why people passionately hate on ruby and IMO dismiss it out of hand. It's so nice to program with.
- xiphias2 3y agoFor me it's quite the opposite. It was the best way to build applications in the past when client side js was hard to use. Many startups took advantage in creating apps fast with RoR. Now that (especially with TypeScript) JS is good enough, browsers and JS engines improved a lot, I start to see less advantages in not using js/ts both for client and server.
- whichdan 3y agoI think Rails is a victim of its own success: many of the hot new Rails codebases from that time are now 10 year old monoliths. And those monoliths need incredible amounts of tests to compensate for the lack of compile-time type checking, Rails version upgrades are multi-month nightmares, and the object-oriented statefulness of the language means that complex load-bearing code can be extremely tricky to untangle. There are certainly new compelling projects like Sorbet to add type checking, and the ecosystem itself is very mature, it's just that the average codebase is not going to live up the experience you might have with a brand new one.
- sage76 3y agoRuby has the worst, most complex syntax I have ever used.
- avg_dev 3y agowow lol. Des gustibus non-est disputandum. i code in go these days. i have done perl and java and some others, started with c, did a bit of python along the way. ruby was always my favorite language. so expressive, so easy to be clear while being terse. i've spent months of my life shortening (my own) verbose ruby code. i switched to go only because of the execution speed and the compilation, a few years back the comparison was not even close. i don't know if i would like to go back to dynamic language... but i found ruby to be such a beautiful language. p.s. this was big when i was leaving ruby: https://rubocop.org/ https://rubocop.org/ maybe there is a replacement now, but maybe it would have changed your view.
- bdcravens 3y agoRubocop is still important; a lot of tooling relies on it, such that many developers may not know they're using Rubocop.
- lobstrosity420 3y agoThe gustibus is unarguable indeed, but calling it “complex” is definitely one of the takes of all time.
- joshmn 3y agoWhat do you consider to be the best?
- nahname 3y agoRuby is practically the pseudocode they teach in schools. Which is selected for it's intuitive and simple nature.
- Toutouxc 3y agoWorst maybe, you definitely don’t have to like it. Difficult to parse, maybe, some things can look similar to other things (blocks and Hashes), but complex from to POV of the programmer? Not really.
- bdcravens 3y ago"The Railscasts Pro videos were recently made free by the author because the videos are dated." Six years ago (2017), not recently. http://railscasts.com/announcements/13 http://railscasts.com/announcements/13
- aigoochamna 3y agoFeels like I read this announcement yesterday. Time flies!
- s4i 3y agoIn my last job I encountered my first Ruby/Rails codebase ever (mostly REST APIs but a few server-rendered views as well). Despite the initial chaotic impression of the codebase (it was a startup after all) with all the Rails magic on top, I really fell in love with the framework after a more experienced Rails dev introduced a few key conventions and helpful libraries to the codebase. Out of those, I’d at least add the RuboCop [1] linter and the BetterSpecs [2] guidelines to this list. Both eliminated bikeshedding in the team and freed up brainpower to solve actual problems: the first one helps you learn intricacies of Ruby bit by bit right in the IDE and the latter one pushes you to write test in a specific style that’s easy to maintain and trust. [1] https://github.com/rubocop/rubocop https://github.com/rubocop/rubocop [2] https://www.betterspecs.org/ https://www.betterspecs.org/
- stouset 3y agoI am blown away by the suggestion to use factories over fixtures. Factories are almost 100% responsible for excruciatingly slow test runs, since you have to rebuild the world every single test. Fixtures work perfectly fine and only need to be created once at the beginning of your test run. For that matter, rspec itself is also a thoroughly unnecessary cargo-culted dependency when Ruby and Rails already bundle perfectly-serviceable, simple test frameworks.
- knappe 3y agoGood luck with those very brittle specs. I have fixed so very many utterly broken tests due to poor spec maintenance mainly due to really poor fixtures. The problem with fixtures is that they do not complain when things go sideways whereas factories are built on top of actual living objects and thus can be validated. You're generally trading speed for correctness in my experience. There is a time and place, of course, for this tradeoff, but we know how to parallelize specs and make test, in general, faster. Correctness is a whole different story.
- seattle_spring 3y agoIf the number of teams developing on your monolith continue to grow, both you and parent will eventually come to the realization that there’s not a good fix for this in Rails. You’ll re-write your monolith into something that scales much better with organizational growth.
- revskill 3y agoThe fact that people love Ruby proved that Human hated parentheses and semicolons.
- trilbyglens 3y agoI think one of the things that sort of stopped rails from becoming mainstream was that when WebApps really took off everything switched to SPA apps. Now that's shifting back a bit (a good thing imo) as many people are starting to recognize the downsides of frontend apps. Next.js is basically one giant workaround for the shortcomings of spa apps.
- faitswulff 3y agoRails isn't mainstream? I'm of the opposite opinion - it's definitely in the Boring Technology† Club. It's well known that it's hard to find a more productive tech stack for building server side web apps. † https://boringtechnology.club/ https://boringtechnology.club/
- deleted 3y ago[deleted]
- kirso 3y agoThis, IMO everyone considers Rails as a solid & production ready framework that stood the test of time. Unfortunately they slept on front-end for too long but seeing a resurgence with a few startups. I think Mastodon is actually using it.
- steve_taylor 3y agoNext.js isn’t one giant workaround for anything. People were building isomorphic SPAs using React long before Next was created. All Next.js did is to put it all together in a simple framework.
- CTmystery 3y agoSome googling tells me that isomorphic SPA means the same page can be rendered server side or client side. Is that what it means to you? It's my first time encountering the term. If so ... people were doing that in react??
- 3y ago
- xyztimm 3y agoMy impression (from years past) is that Ruby is what developers loved. It was my first “real” programming language and the reason I fell in love with coding. These days I’m mostly writing in JS and Node for work. Rails is the money-maker, but the philosophy of convention over configuration is why it really off IMO, and something that is both underrated and missing in the JS world.
- mberning 3y agoGreat collection of resources.
- fallingmeat 3y ago1 point by fallingmeat 1 minute ago | next | edit | delete [–] Why do similar articles or headlines seem to come up at the same time on front page? e.g. there is another article on Rails that happens to be front page right now that is seemingly otherwise unrelated (the other article is called The Rails Doctrine).
- Tronno 3y agoI went all in on Rails a couple of years ago. Although the overall feature set is amazing, code discoverability has been a frustrating stumbling block from day one. The "magic" (convention over configuration, autoloading, metaprogramming, etc) makes it difficult to know what methods are available to use. I end up over-relying on the official docs, which are of inconsistent quality. One example: api.rubyonrails.org lacks code examples, doesn't usually state what a given method returns, and many entries are outright blank. Editor integration could help, but feels lackluster. With TypeScript in VS Code, hints come up as I write. I can hover anything to see its type, methods, and source code. With Rails, I can poorly approximate this behavior with a collection of half-functional community extensions, or I can buy and use the slow, bloated RubyMine IDE. Rails enabled me to build my product, but my experience doesn't match the love I hear from other devs. I wish I knew how to make it click.
- tmm84 3y agoThis was my experience and I have commented it before. The magic/convention approach is the inferred part of Rails/Ruby culture. Where is the class definition? Well, where are you invoking initialization? This question leads to a question which hopefully leads to answer is hard to play by if you’re new or just trying to squash a simple request. The whole just fire up an interactive session or rails console is probably the last thing I want to do but probably the only way to diagnose or figure out how things are truly working. What monkey patches are in the mix, what libs override methods I set, etc. For me, Ruby is one of those programming languages that obviously takes a different programming approach and mindset that I don’t have. I don’t think Ruby is bad but I know it isn’t the tool that fits my skill set.
- q7xvh97o2pDhNrh 3y agoI went all in many years ago and then moved on several years ago (to different parts of the stack that I found more interesting), but here's my 2c FWIW. The Rails Guides [1] are quite good (and much better than the API docs, even for the same topics). The "Getting Started" guide, in particular, was my first intro to Rails, and it's what convinced me to go all in — I built my entire prototype by just following along the guide, seeing what they were doing with their toy app, and then trying to whatever similar thing I needed in my app. Coming from Python, the magic was distasteful to me, too. Rails adds a ton more magic on top — so, eventually, when I set aside Rails and just spent time with Ruby (writing scripts or what not), I realized I loved Ruby the language much more than Rails the framework (and all its baggage). Stripping Rails down to its API-only mode (though it was a bit rough around the edges last I tried) got me closer to the Ruby of it all. Sinatra turned out to be a delightful little framework (though sadly I never got a chance to use it much). And, even though I've now moved on from Rails, I still like Ruby as a go-to scripting language — it makes it fun and easy to throw together a quick shell script or some data analysis, and it's very friendly to a functional programming style. I guess what I'm saying is: You're not alone. Many people in the Rails community agree that there's a ton of hidden magic, sometimes too much [2]. But underneath it all is a delightful programming language. [1]: https://guides.rubyonrails.org/ https://guides.rubyonrails.org/ [2]: The docs for the Rails routing layer, Journey, are my favorite example of this: https://github.com/rails/journey#label-SYNOPSIS-3A https://github.com/rails/journey#label-SYNOPSIS-3A
- random_acc 3y agoIt’s always so odd when these type of posts pop up and I scroll through and see comments about how people love Ruby/Rails. Mainly because I can’t stand the language and framework. I absolutely hate any time I have to read through Ruby/Rails code or write something in it.
- montroser 3y agoAgreed -- over the years working in many different languages and frameworks, I've found it most difficult to transfer experience and learnings to rails. Whereas in pretty much every other stack, I can trace through and read code to understand how the framework and library code and dependencies all work together, in a rails app, I have to read docs to grok magic. With all the metaprogramming, it is near impossible to just read code and get a sense of what all is happening in any reasonable amount of time.
- shortcake27 3y agoWhy is it odd? Are people not allowed to like things that you don’t?
- random_acc 3y agoOf course not. Just odd in the sense that I am on the other side of the fence, so I feel left out :) Just not my cup of tea I guess.
- shortcake27 3y agoApologies, as the other response suggested I read into it wrong. Rails is definitely polarising - people either seem to love it or hate it.
- meepmorp 3y agoNot OP, but I believe you're reading the wrong thing into that response. For me, the responses are fascinating, because many of the things people seem to love about rails (and ruby) are the ones that I hate. It's not that you're not allowed to like those things, by all means feel free - I'm just perplexed. Fwiw, I regularly use ruby for work (with and without rails) and I'm fairly competent with it. I just think it sucks.
- theflyinghorse 3y agoRails made me more confused than Spring did. The amount of magic makes it really hard to reason about what's going on.
- alex_lav 3y agoIME you’re either a Rails Person or you’re not, and it’s hard to make either group understand why the other likes it. I also couldn’t understand why people would be okay with so much being hidden from them, or made in a way that removed the ability to reason about it externally, but my Rails colleagues just liked it and didn’t understand why I’d care. Different strokes I guess.
- shortcake27 3y agoIf you know what Rails is doing then it isn’t hard to reason about. This comes with time/experience & reading Rails source. Magic is a beautiful term for what Rails does, because just like a magician’s tricks, it’s possible to have a full understanding of what’s going on. It’s not as if Rails acts randomly.
- alex_lav 3y agoYes, that’s why I also wrote about the ability to reason about what it’s doing. You don’t have to search for a magician’s tricks if the intention is for you to be able to infer or intuit what they’re doing. It’s magic when the only way to know is to be told. Which is, to me, a nonstarter for software.
- bigtunacan 3y agoRails has always been fully open source. If you didn't understand something you simply looked at the Rails source code. At the time it came out most people were using .NET or Java which were largely closed source and PHP which was open source, but there were no real frameworks at that time. CodeIgniter and Cake came out in the couple of years following and were both immature in comparison.