I am a senior dev using Rails exclusively — ask me anything maybe I can help

I want to pay it forward for all the help I received that helped me being where I am now 😁 I am with Rails since version 2 (around 2009) and made several projects that are used by thousands of people worldwide. Maybe I can help you with some questions bugging you about rails and engineering in general?

40 thoughts on “I am a senior dev using Rails exclusively — ask me anything maybe I can help”

  1. How do you deal with optional string values in a relational database in combination with queries including a “not”, for example: User.where.not(name: “Frank”) ? Problem: This query would not find records where the name is NULL.


    \- Making an “or” query to also fetch the records where(name: nil) (Proper solution, but easy to forget)

    \- Or setting a default value in the database to be an empty string for the given column?!

  2. This feels so dumb, but:

    How does one get Devise and a React front end to be friends? I took a recipe app example and want to expand on it as a personal project, but can’t seem to find a way to get user/password validations via Devise to function.

  3. I just started as a BRD with a rails company. Could you summarize rails for a person who has never coded before? And the main advantages of rails.

  4. How do you use Devise and bolt on a bunch of custom fields to your model? I’m getting tripped up by the routes like index. Is it all #registration and #session controllers?

  5. Are rails applications “stateless” by default?

    I often wonder if I could autoscale my application (using some Cloud Deployment for example)?

    For me Rails often feels like “magic”. It’s cool, because it makes it very simple and fast to develop basic stuff, but I never really feel like I understand the internals and therefore the implications of my code.

  6. Do you use ruby on rails? And if so (and in general) where is a good place to start? What about a good place to get practice resources (i.e. a ‘challenge’ to code or such)?

  7. Hey there ! I just started a new job as a Rails and React developer after 5 years of Java. I did not know anything about those 2 frameworks when I applied for this new job.

    What shocks me the most is that “unit testing” seems to be impossible because ActiveRecord always communicates with a database (hence becoming “integration testing” because of the dependency on the external database). Every test takes at least 1 second which feels very long… (I am used to milliseconds).

    I can’t really find anything interesting on true unit testing strategy on rails or on TDD with rails. What learning resources or books would you recommend on those subjects?

    Also, Rails seems to be working like magic sometimes. So many things going on under the hood… How do you usually tackle understanding something that Rails does implicitly?

    Thanks for sharing!

  8. It my first year with ruby been hearing in boot camp you need to contribute to open source but still can’t what I should do ?

  9. Hi I’m a beginner. What do you recommend to use for front end development thinking in mobile. I got a little confused how rails work and just started to study rails API only to use some other framework like react but I’m don’t like the sintaxis. There’s something more similar to rails that I don’t need to use API calls but will look nice on mobile? Or I’m completely lost here?

  10. This is so cool, thank you for doing this!

    Let’s say there was an index of “posts” like the front page of Reddit, and each “post” partial was cached, is there a common convention for showing an individual user which posts they upvoted/saved/etc?

    Would it make sense to add the IDs of the user’s liked posts as a data attribute somewhere on the page, then use JavaScript to mark the corresponding posts as upvoted/saved/etc? Feels a bit wonky if there’s multiple interactions that a user could have per post, is there a better approach/convention for this? Or is it just kind of a case by case thing.

    Sorry if the question’s not really fitting, it was the first thing that came to mind. Thanks again for doing this!

  11. Heya! Thanks for sharing your expertise. Does an action cable subscription keep a puma thread busy? I don’t seem to be able to figure this one out and can’t find answers!

  12. How do you keep test suites reasonably fast (disregarding the E2E tests)?

    Do you embrace mocking & stubbing in tests or avoid it? According the books it would make tests **fast**, have seen that in reality?

  13. A couple of questions for you

    1. What language/framework is most similar to Rails? Rails syntax is so foreign looking to me sometimes, in particular symbols and the fact you don’t need to enclose function parameters in parentheses.

    2. Would you ever want to use a different language/framework or is Rails the greatest thing ever in your eyes and you don’t want to leave it?

  14. How are you feeling about the future and current direction of Rails / Ruby? Are there any other frameworks or languages that you’re excited about?

  15. How do you deal with complex business logic? Do you have a service layer? Do you use a framework? DDD? Fat models?

  16. How do you deal with complex queries, like – wall of text SQL queries? Do you try to shoehorn these into Arel?

    I don’t – because usually in these cases I need hashes and not objects as output. Am I doing it wrong (writing the query getting the result and moving on)?

  17. Hi can you help with the below i am trying to build a rails app to help me keep track of the times i spend in meetings and i am just stuck on the below

    I have a meetings table:

    rails g scaffold Meetings name:string start\_time:datetime end\_time:datetime

    I have calculated the duration time in between a meeting start time and end time:



    duration (end\_time – start\_time).to\_i



    def duration\_display(meeting)

    duration = ActiveSupport::Duration.build(meeting.duration).parts format(‘%02d hours and %02d minutes’, (duration\[:hours\]||0), (duration\[:minutes\]||0), (duration\[:seconds\]||0))



    <%= duration\_display meeting %>

    But I’m struggling on how to calculate the total time duration of meetings within a day and total time of meetings within a week period.

    Is there an easy way in Ruby on Rails of summing the total time durations within a specific date range? Below is a sample of the output i am trying to get:

    Start Time End time Duration

    2021-08-01 01:08:00 2021-08-01 03:20:00 02 hours and 12 minutes

    2021-08-01 14:20:00 2021-08-01 17:04:00 02 hours and 44 minutes

    Total meeting time for Start Time : 2021-08-01 = 4 hours 56 minutes

    Total meeting time this week is 15 hours 28 minutes (based from Monday to Sunday)

  18. Hi I would love to be a rails dev but everything keeps changing so quickly and I end up giving up. How do you stay focused and keep upto date with all the changes? Would you ever consider mentoring?

  19. What kind of architecture do you suggest for keeping an audit log of user actions in a rails 6 app? Do you recommend a separate database? A certain type of database? Leverage a gem? If so which one? How would you approach this problem if the requirement is essentially as follows: “we want to be able to query what a user did (CRUD operations) at any given time”. Thanks!

  20. What do you think about the sorbet and sorbet-rails gem? I’m new to the framework and understand new (untyped) code has been hell to me. It seems like there is too much many and unspoken rules to it

  21. How have you handed database failover in a rails environment? Do you exclusively use a managed DB service, or is it common to use a cluster of replica db servers – and if so, what have you found best practice / just works for pointing a rails app to the correct primary or replica? Much appreciated.

  22. Big monolith application (not complex or tangled, just big, with lot of different modules, large db, lot of models, with nice separation with private interfaces, etc) or smaller “micro” apps.

    What’s your experience with RoR?

  23. When did you start to consider yourself a “senior” engineer? I’m interviewing for a “senior” role and I’m wondering if I’m getting in over my head

  24. Is there anything like Dreamweaver that can make it easy to write crud apps? In a database guy. I’d love to get into ruby. And my web development skills are sorely out of date.

  25. I’m wondering what the best way to create a SaaS application (multitenant with Acts\_as\_tenant gem) in Rails like Shopify, I want to let users point a custom domain to their account and access all REST resources and routes with that domain.

    At this point, I have only tried with subdomains for each tenant but I can find a tutorial or blog post to have some guidance on how to do it with domains at the DevOps level, I mean Nginx config, SSL (let’s encrypt), Customers domain registrar config for DNS, etc.

    Do you have some guidance on it?

  26. Is it best to mirror your ActiveRecord validations in the DB (via non-null constraints, etc.?) Or would that just be introducing unnecessary duplication of logic? (Assuming the database isn’t altered by anything outside of the Rails codebase.)

  27. TL; DR My RoR application must use an Oracle database.

    When I read your offer, my first reaction was great joy. I am assigned to support a RoR application developed as (IMHO) a highly functional POC or prototype that was so absolutely brilliant and genius that, as so often happens, implemented in production mode at the insistence of the client. While the creator was truly gifted, it was built quickly and depends heavily on gems, some not so great for long term use. You could call it a passion project – the person who built it had no software development training or experience (but plenty of vision), and they don’t have the bandwidth to support it. They have responsibilities elsewhere. But this application LOOKS like a mature product and needs maintenance, lacks features you would expect, and as a deployed application it has other deficiencies. I needed a job, so I took it, and here I am.

    I have a rich and varied background with application development, but the RoR framework was completely new to me. It has been my challenge for the past 3 years to adequately support this application beyond simple maintenance and break/fix work. In complete isolation. And for ***reasons***, I cannot post my code when I reach out for help.

    As I began to draft a question for you, I realize that it is not necessarily the RoR framework I struggle with – most of my challenges involve the gems that form the foundation for my application.

    So, I will pick one of the issues that make my teeth grind at night and hope for advice.

    I have been trying to upgrade my Rails 5.2 application to Rails 6.x in order to leverage functionality that I must currently rely upon gems to provide – e-mail and file attachments specifically.

    The problem is my database. For, again, ***reasons***, I must use Oracle as my database. I depend on this open source gem:

    * activerecord-oracle\_enhanced-adapter

    The author and maintainer of the gem has decided to drop support for a certain feature as part of his version update for Rails 6.x. (it has to do with sequence numbers and triggers.) After tracking down the developer and practically begging, he has reluctantly agreed to *consider* implementing the feature in his Rails 6+ gem versions. I get the sense I am an edge case, and have little hope that the author will spare his valuable time and attention on my situation. I have sort of given up and resigned myself to remain on my current Rails 5.x version.

    So, after all this story telling, do you have any advice? Beyond migrating my data to a different database (it’s not an option). It’s OK if you don’t, this may not be the kind of help you are offering.

  28. What IDE should I use for Ruby? I don’t really care for VS Code, how about something from Jetbrains? Good Tutorials on youtube or something? (technically I HATE video tutorials, I just want it written out)

  29. I guess I should state googling “How To Develop With Ruby on Windows”

    I use Linux, but I sure as FUCK ain’t stupid enough to be a poser that uses Mac bullshit

  30. Thank you for your wisdom – there’s some great information in here!

    Do you have any advice for a senior front end developer that wants to transition to working with Rails fulltime? Would a portfolio of apps be beneficial or am I better off leaning on my general programming experience from javascript? I don’t have any production experience working on the backend or fullstack, but I’ve built several hobby projects in rails and have always had a blast with it.

    I absolutely love ruby and rails and I’ve found myself really wanting to transition to a more stable technology with a great community

  31. hi so my question is about javascript per view , i noticed that my script get call/load multiple time and if im not mistaken i read it on blog that you shouldn’t put turbolink in body tag but head tag instead, but i don’t get it does that mean i don’t use the layout and render a full html??


Leave a Comment