Custom Method in Rails Controller -
i need call custom method in controller android app. have table name 'lists' has multiple columns 1 of them being 'tableno'. need call controller method fetch rows lists table in db passed table number , return json. in app read json. have defined method in lists controller below:
def tableorder @list = list.where(:tableno => params[:tableno]) respond_to |format| format.json { render json: @list } end end
in routes file have given
resources :lists member 'tableorder' end end
and url using execute android app lists/tableorder
get
method. parameters send android app jsonobject: jsonobject.put("tableno", tableno);
. tableno here actual column name in lists table.
the problem not executing query , giving missing template error. checked server , not reading params have sent. new rails , writing such thing first time not sure if missing something. please advise. thanks.
attempt hit lists/tableorder.json
instead. default format .html, , why complaining cannot find template.
Comments
Post a Comment