mobile app JSON calls to controller


I’ve controller methods which my mobile app calls to retrieve JSON.

I’m curious what is the best practice in naming mobile methods? Do I put all the mobile calls into a new controller? Right now I’m only prependng ‘mobile_’ in front of the methods like session/mobile_create.

Right now the mobile functions are quite different from the Web ones. So a sessions/create VS sessions/mobile_create is different and so mobile_create news to exist.

I’m not sure I understand exactly what you’re doing, but I’m assuming when you refer to a mobile app you mean a rails app running on a mobile device (as opposed to an app developed in Cocoa or Android that is accessing your API). In that case, I would recommend Rails 4.1 as they have developed a standard that is a lot easier to use. Look at the section “ActionPack Variants” at the following link:

Thanks for the link Mike. Actually I my mobile app is using PhoneGap. So it does JSON calls to my User controller.

Been looking for a better way to organise the methods. Right now in addition to Create, I also have Mobile_create in the User controller because Mobile_create is slightly different from Create.