I have a controller action that responds to the same root in two formats - html and json. But the code that runs for the html response is completely different than the one for the json response.. Now I have something like
def index
result_html = ...
result_json = ...
respond_to |format|
format.html
format.json { result = result_json.limit(10) }
end
end
and I would like to have it like
def index.html
result_html ...
end
and
def index.json
result_json ...
end
What would be the best way to organize it?