user2632560
user2632560

Reputation:

What is best way to write api in rails with authentication?

I want write api for my rails application and with authentication. I want to pass my associations data also but in selective and conditional manner.

If I use respond_to block for that then there will be a lot of mess in my controller that i do not want any ways.

What is best way to accomplish this?

Upvotes: 1

Views: 1397

Answers (3)

Manoj Sehrawat
Manoj Sehrawat

Reputation: 1303

Try these gems jbuilder rabl rails-api. You can see free railscasts for

Some other very good railscasts related to api

Upvotes: 0

user2801
user2801

Reputation: 314

If the purpose of your application is only API then you can go with RAIL_API Gem and your can configure you JSON reponse using RABL

Upvotes: 1

Jun
Jun

Reputation: 114

You can have a look at grape. It is a REST-like API micro-framework for Ruby, and it has a related gem grape-entity which defines the attributes to expose. They should be what you want to use.

Upvotes: 1

Related Questions