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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -