14 ms·
How to build a search engine with Ruby on Rails
- gscho 5y agoThis is a bit off topic but I wanted to say I’m really glad there are still people out there hacking on some ruby + Postgres projects and writing about it. I feel that ruby is an excellent language and dread the demise of it.
- jrumbut 5y agoI think if Rails didn't exist and someone released it today, it would be exciting and worth switching to.
- jamesfinlayson 5y agoAs someone who has recently started using Ruby for some personal projects - I agree. I like the simplicity of it and that I can do simple command line one liners with it.
- semisober 5y agoExactly, I only started maybe a month ago and incredibly simple to get into.
- marjoram 5y agoIronically, I think that's part of the reason it became trendy to hate on Ruby and Rails: they make it really easy to do things, which means they also make it really easy to do ill-advised things. But that's not really the fault of the lanaguage or the framework - writing good and maintainable code is a skill you need to work at and develop over time, no matter what language you're using.
- smoyer 5y agoRuby is a beautiful language - Rails is opinionated (much like its creator). If the ways Rails is opinionated works well with your use-case, it's wonderful to use but if not, it's simply horrible. I don't think RoR usage has declined (maybe as evidenced by the number of "I'm a newb" comments here?) but rather think it's become mainstream so it's simply missing the hype it had when it was the new hipster technology.
- ljm 5y agoIt's not so different to the same kind of elitism that gives, say, PHP or JS a bad rap. They just happen to be successful, and popular. I don't think the trope of Ruby being old and boring is such a bad thing either, it just means it's stabilised and has a strong ecosystem that requires little to no effort to get set up. And it still gets a lot of love with every Christmas release adding something desirable and new. I also think it will require some immense innovation or paradigm shift to unseat Ruby/Rails as a de-facto framework for rapid web prototyping. I would still kick off a project with Rails in favour of trying to early-adopt some new approach to development.
- rdhgfdgrdhgfdg 5y agoHow is it demised? Shopify, Stripe and many new YC startups use it.
- itake 5y agoRails hasn't had any interesting updates since version 4, and arguably introduced a few regressions IMHO (I'm looking at you, active storage and action cable) Ruby hasn't evolved much either. Rails only scales so far and then scaling gets really challenging, obviously the named companies have figured it out, but its not easy. For example, rails due to the high coupling between models and the database, rspec test get very contrived trying to setup the db state for each test run. Compared to other languages like Python or golang where the sql-layer is abstracted from the model layer. Compared to languages like Python which provide very similar developer experiences but also the power of ML modeling, ruby is falling behind.
- ipaddr 5y agoI highly doubt that you will reach the scaling limits of rails unless you have a massive product and even if you do Python would not be a good replacement.
- wpietri 5y agoDepends on the product. The Rails architecture is fine for CRUD apps, and Heroku will happily take more and more money for more and more database capacity. As long as your ARPU is solid, you're fine scaling like that. But there are more things in the world than CRUD apps. I'm building tools to track hate on social media, and there's a lot of social media out there. Rails, or any RDBMS-centered architecture, won't cut it. And if you're not using Rails, then I think the case for using Ruby isn't very strong these days; Python has a bigger community and is much stronger in important niches, like ML. So we picked Python as our default language not because the Python runtime is vastly more efficient than the Ruby one, but because the ecosystem is a much better match for our needs. I wish it were the other way, as honestly I like Ruby better as a language. But my personal tastes are ultimately a pretty small factor when I'm picking the tooling for a project.
- gamechangr 5y agoRuby is still an amazing language Rails needs some help
- meremortals 5y agoWhat would you change about Rails?
- Mikeb85 5y agoHow so? Plenty of large companies still use Rails. Plenty of startups still use it. I remember when SPAs were all the rage, now every JS framework is doing SSR, just like Rails did/does. What full-stack framework is as complete *and* allows for the same speed of development?
- moksly 5y agoSome of the most interesting projects I stumble on as part of the public sector digitalisation in EU are made in Ruby on Rails (Southern Europe, especially Spain/Portugal), PHP (all of EU) and Python (Eastern Europe). Having recently switched most of our internal development from C# to Python and Powershell I get it. I can’t imagine not building small web apps in Python and I imagine PHP and RnR are exactly the same experience of getting things to simply work extremely fast.
- Spone 5y agoParts of GOV.UK [1] and the Paris.fr website [2] are also good examples [1] https://github.com/DFE-Digital?q=&type=&language=ruby&sort= https://github.com/DFE-Digital?q=&type=&language=ruby&sort= [2] https://www.paris.fr https://www.paris.fr
- keewee7 5y ago>Having recently switched most of our internal development from C# to Python and Powershell I get it. How was the move from C# to Python?
- danijelb 5y agoFirst one that comes to my mind is Decidim (https://github.com/decidim/decidim https://github.com/decidim/decidim, https://decidim.org/ https://decidim.org/)
- arthurcolle 5y agoThis feels like the idiom of 'those who can't do, teach' except its... puts "those who aren't building interesting systems in #{RUBY_ENGINE} write comments about #{RUBY_ENGINE}'s demise" No one cares what you are developing your product in. Maybe some intern during an interview is salivating about your $BESPOKE_IMPLMENTATION, but at the end of the day, Ruby and other dynamic languages solved a very explicit problem of "hey compiled languages are great and I can design a very high level system and then needle down into whatever I want to behave in very explicit ways, but damn I want to get this done in like 30 minutes instead of over 3 days" I feel like anyone who needs a blog post about some sorceress' concoction of systems to feel validated about making something that solves a problem, especially a problem of theirs - even if it's for your grandma, or a few close friends, or even just yourself... you just don't get it. waxing philosophically about tech is fun and gets any number of rocks off but at the end of the day, if you love scheme and know how to whip up something in 30 seconds that would take an hour in java 17 pro max (ellison edition), go for it, publish it, run it on your raspberry pi. This fixation on chasing the dragon every 15 minutes is a complete waste of time and is effectively super counterproductive. How many breaking changes has node gone through? Our boy Ryan Dahl literally reimplemented a JS runtime as Deno in Rust because he was like "ya i made node and it was cool for a bit but this is getting out of hand" Great! Use Deno! Use Node! Use Fortran if you're productive in it. The idea that you have to curate what shit you're learning because of a predicted decline in the ecosystem of said shit is such a waste of time and I shake my head in sadness at anyone who isn't learning something because they fear it might be deprecated tomorrow. Be the change you want to see in the world. If anything, the APIs youre using in $POPULAR_LANGUAGE will be deprecated and the APIs that are not getting blog posts on HN are actually still stable. Run it in a container! Who cares! You know what will be not important? deep ponderences of some tech rolled out over an API like AWS Lambdas or Google's AMP stuff, or React, or Angular (remember that? Lmao! Only a few years ago!). Focus on fundamentals and avoid the constant churn of new features that get deprecated 6 quarters from now.
- gouda-gouda 5y agoRuby is alive and well. We don’t use Rails specifically (Hanami + ROM.rb + DRY.rb), but absolutely love Ruby as a language and the ecosystem surrounding it. It’s productive, and as powerful as you need it to be. When it comes to building feature-rich web applications quickly and sanely, Ruby is still hard to beat IMO.
- Toutouxc 5y agoI love the section about getting rid of Active Record only to discover that the handwritten SQL equivalent is unmaintainable and slower. Also if you're on the fat-models team and you have lots of behaviors and business logic on your models, it's often easier to just go with Active Record, because the second you wander off the beaten path (e.g. handwritten joins) you start dealing with weird franken-models that contain attributes from multiple tables, but not their behaviors (methods, callbacks).
- moffkalast 5y agoEveryone asks how to build a search engine with Ruby on Rails, but nobody asks why build a search engine with Ruby on Rails...
- pqdbr 5y agoGreat article. By the way, ActiveRecord's #merge is golden, and I'm under the impression it's not as mainstream as it should be. I use it extensively to avoid duplicating scope code. For instance: class Listing scope :active, -> { where("expired_at > ?", Date.current).where.not(suspended: true) } end class User has_many :listings end So instead of doing this (which is terrible): user.joins(:listings).distinct.where("listings.expired_at > ? AND listings.suspended != FALSE", Date.current) You can simply: user.joins(:listings).distinct.merge(Listing.active) Rails docs are amazing, but #merge doesn't get enough love. Maybe I'll issue a pull request to improve it with some examples like this and the ones from the article.
- clairity 5y agothat’s one of those little niggles i’ve had about rails that gets solved so neatly eventually. i started with rails 3 (#merge is a rails 4 addition) so i didn’t know about #merge for a while (#or was another nice addition), and was doing a lot of that ugly chaining in the beginning. same with js - with the move to frontend without webpacker and node, i’m eager to try out rails 7 alpha to see what the dev ergonomics are like now.
- elesbao 5y agoGood post, well written, taught me a couple of things I didn't knew and uses Ruby in a clean way. I don't think it meant to be uber scalable but last time I had to build search in ruby I had to use Ferret (a great lib) and it was not this straightforward.
- gsinkin 5y agoGreat post at the perfect time. I am currently wrestling with some gnarly, expensive queries in postgres and this gives me some great leads to try out. Also, I appreciate the Rails love. I know this is not a Who Is Hiring post, but if you are into Rails/Postgres and in the market (between UTC-4 and UTC-8 timezones), feel free to send me a note: gabe at instrumentl.com. We are doing some "biggish" data work helping nonprofits find grants and other fundraising opportunities.
- deleted 5y ago[deleted]