Henley Wing Chiu
Henley Wing Chiu

Reputation: 22515

How to specify a controller method will ONLY return jSON?

I have a controller method that will return just JSON. It will never be rendered in HTML ever. I know I can call controllerMethod.json?params=BLAHBLAH and it will return JSON for me, but if someone calls controllerMethod?params=BLAH I always want to return JSON as well... How do I do this?

Upvotes: 2

Views: 1525

Answers (1)

jschorr
jschorr

Reputation: 3054

just do only:

respond_to :json

Upvotes: 5

Related Questions