Rails: admin routes to manage non-admin models -
i having problem trying configure rails managing non-admin models using 'admin' namespaced routes. example, widget model have restful route @ /widgets controller called widgetscontroller, have routes file namespaces routes , controller:
namespace :admin resources :widgets end class admin::widgetscontroller < applicationcontroller def index @widgets = ::widget.all respond_to |format| format.html end end ...etc... end in views getting error when seek utilize route method create:
<% @widgets.each |widget| %> <%= link_to 'show', admin_widget(widget) %> <% end %> error:
undefined method `admin_widget' what doing wrong?
i missing path @ end of method name. should have been:
admin_widget_path(widget) instead of admin_widget
ruby-on-rails
No comments:
Post a Comment