Here's the page template I've got:
<h1>Editing user</h1>
<% form_for(@user) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :forename %><br />
<%= f.text_field :forename %>
</p>
<p>
<%= f.label :surname %><br />
<%= f.text_field :surname %>
</p>
<p>
<%= f.label :address %>
<%= f.text_field :address %>
</p>
<p>
<%= f.label :postcode %>
<%= f.text_field :postcode %>
</p>
<p>
<%= f.label :contact_number %>
<%= f.text_field :contact_number %>
</p>
<% end %>
<%= link_to 'Show', @user %> |
<%= link_to 'Back', users_path %>
The controller is actually sub-typed from the AdminController as there's a separate section as the following class declaration shows:
class Admin::UsersController < ApplicationController
with the edit method as follows:
def edit
@user = User.find(params[:id])
end
With the error as follows:
undefined method `user_path' for #<ActionView::Base:0x104369fe8>
and the following in my routes:
map.namespace(:admin) do |admin|
admin.resources :pages
admin.resources :treatments
admin.resources :users
admin.resources :finances
end
So I'm a bit stuck, because it's the form_for(@user)
that's doing it. I've seen this before but have no idea how to diagnose it unfortunately.