Using Ruby on Rails For Your Back End


a note:

We’ve recently added the ability to do our curriculum without touching Ruby or Rails at all! If you have no interest in adding JavaScript to Rails then consider this unit completely optional!

It’s finally time to tie all this juicy Javascript back to what you learned in Rails. In preparation, reread the Rails lesson on building an API to refresh how to set up a Rails backend that can handle JSON requests.

At this point, you’ve got all the tools you need, so it’s time to practice allowing your front end Javascript to talk to your Rails backend using AJAX. We’ll cover some best practices for how to pass data from one to another, but otherwise you’ve got all the tools you need to put together those final pieces of the web development puzzle.

Note that you can actually outsource your back end functionality to a Backend-as-a-Service (BaaS) company like Firebase or Apigee, but you’ve already got the skills yourself, so let’s use Rails!

Learning Outcomes

  • Refresher – how do you set up a basic Rails app?
  • Refresher – how do you load custom Javascript in a given Rails view page?
  • How does “unobtrusive Javascript” work?
  • How can you pass data from your Rails app to your Javascript?
  • Why would you want to use AJAX to load large batches of data?


  1. Check out “Using Javascript in your Rails App” from Daniel Kehoe. It is long and covers a lot of ground, but it’s got great content. Some of the stuff on dependencies can be skimmed, but pay attention to the content_for stuff at the bottom.
  2. Refresh yourself on Rails AJAX from RailsGuides (just skim the top few sections).
  3. Read Bootstrapping JSON data into a Rails View to learn about passing data to your front end.

Additional Resources

This section contains helpful links to other content. It isn’t required, so consider it supplemental for if you need to dive deeper into something.


Using Ruby on Rails For Your Back End

Have a question?

Chat with our friendly Odin community in our Discord chatrooms!

Open Discord

Are you interested in accelerating your web development learning experience?

Get started


  • 5-6 months

    5-6 months

  • Job Guarantee

    Job Guarantee

  • 1-on-1 Mentorship

    1-on-1 Mentorship