reactjs - Rails custom route does not map correctly -
i´m making ajax request controller having problem routing. request: (using react.js)
$.ajax({ type: 'get', url: 'allrooms', datatype: 'json', success:function(data){ this.setstate({data:data}); }.bind(this) });
i´ve put in routes.rb:
'allrooms', to: 'rooms#allrooms'
now, allrooms
method defined inside rooms_controller
however, request gets url when trigged: http://localhost:3000/houses/allrooms
the call made show-view of house-controller.
why not request route rooms-controller? (i´ve restarted rails server multiple times)
try changing js code as:
$.ajax({ type: 'get', url: '/allrooms', datatype: 'json', success:function(data){ this.setstate({data:data}); }.bind(this) });
Comments
Post a Comment