Server-side code for RoR; fetching data