connecting with rails endpoints