Back

Learning Rails after Bison’s JAMstack

Kim WilkesThursday, May 6, 2021
Photo of train tracks amidst red fauna

I’m a Software Engineer at Echobind learning and developing skills across various tech stacks. To help with that, we get something special called Investment Time, 8 hours a week, to dedicate towards learning some skill that would be beneficial to both ourselves and the company. Now, I recently had the wonderful opportunity to work on a greenfield project, from start to finish, that would use our company’s JAMstack generator, Bison. Its tech stack includes: Next.js, TypeScript, GraphQL, Prisma, Chakra UI, and React Hook Form.

I have always enjoyed working with React and the front end but being a full-stack developer, I should also maintain some expertise with the backend. Knowing that some future projects may require knowledge of Rails, I set that as my goal and used my investment time towards recreating some of the functionality of that Bison project but using Rails. My only other experience with Rails before this learning adventure was during my General Assembly bootcamp for one project’s backend. I had appreciated the simplicity of quick setup using the scaffold command generator but that was about as far as that understanding went.

I wanted to share my findings from this effort because I came across the opinion that Rails is old news while going through tutorials and researching aspects of it. I want to highlight features instead of insisting on the relevance of one thing over another given my limited experience.

Similarities

  • Fast and easy to spin up a new app.
  • Schema file that shows the structure of your database models.
  • Create DB migrations based on the aforementioned schema.
  • Static and Dynamic routing
  • Make “components” that get pulled into pages/views: Rails allows partial html to be rendered in other pages would be pulled into as similar to making a React component that could be used throughout the app.
  • Pre-configured generators (Bison App lists commands in package.json): for example, .
  • Html with code mixed in: and . For example, you can run for loops to build out the data for a table or list.

Differences

  • The Schema file in Rails is sacred and not to be touched whereas Prisma’s Schema file is where the modeling magic happens, which Bison would auto-update the and .
  • Rails’ MVC is fully separated and does not typically get pieces mixed in. React “views” can have the “controllers” included in the file.
  • Pending migration in Rails stops you from continuing to see the page view and must finish migrating before continuing.
  • RESTful vs GraphQL: can set up Rails with GraphQL but not right out of the given Rails box.
  • Routing seems simpler in Bison: Bison → immediately can open that page with a pre-generated component with the page's name to help visually confirm its creation. Rails → add to the file → have a controller related to that route → all of which requires a model related to all of it.
  • Rails came with a lot of directories that I did not end up using and have no idea what to use them for, but may be relevant for more complicated projects.

Cartoon of man on ladder touching large computer

In the Future

Now that I have more familiarity with the error page, I’m not as immediately terrified of seeing the bright red header (which provides a helpful tip on where to start your debugging efforts) as I used to be. I learned to have a bit more patience while parsing those error messages and appreciated that Rails made a full stop on whatever I was trying to do before potentially starting a never-ending loop.

I loved the challenge of trying to replicate the functionality of an app through Rails because I had a reference point to chase and could see the appeal of one tool over another for various goals. I was pleasantly surprised that I could spin up a full app using just Rails and a few helpful gems. I also appreciated the already included Rails features like Action Mailer to be able to send emails within the app and Active Storage, which included explanations of how to add various cloud storage options for one-to-one and one-to-many files for a record. Between the generators and these extra features already built into the base template, it’s hard not to describe Rails as “magic.”

If you were to ask me which tool would I use going forward, then I’d have to say that I don’t have a good answer for that yet. I’m sure this will change as I get involved in more projects and get a better feel for what tools make the most sense to me and for the needs of a project. I’m still in the “sponge” stage of my engineering career; I want to learn everything and anything I can soak up, though I know there’s a limitation to how much knowledge will really get pulled in. I feel more of a pull towards Bison’s JAMstack just because I’m so curious about using GraphQL in comparison to REST. I’ll certainly be using my next quarter’s investment time towards GraphQL to have a deeper understanding and look forward to reporting what I learn then.

Share this post

twitterfacebooklinkedin

Related Posts:

Interested in working with us?

Give us some details about your project, and our team will be in touch with how we can help.

Get in Touch