I am currently trying to add some parsing methods to a controller method in a Rails 3 application.
I have a controller action as follows:
def control
@device = Device.find(params[:id])
<do things>
parse_return(@returned_data)
end
and I added a custom method to the controller as below (this method would not have any routes and would only be accessible to controller actions):
def parse_return
<parse data>
end
but this does not appear to allow the parse_return method to be used. Is there somewhere else in the Rails app that I can put re-usable methods?
Thanks!
At a first glance it seems that you fail to render a response. Is it true that
controlaction doesn’t have an associated view?In this case you have to manually call
renderin your action. For example, to render JSON response you can do this: