Hi,
Very fustrating problem.
I''ve nested by /admin bits with a namespace ...
map.namespace :admin do |admin|
admin.resources :dashboard
map.resources :users
map.resource :session
admin.resources :organisations
end
I''m having an issue with :organisations though.
The controller and view are in the /admin folder and the controller''s
class definition is ...
class Admin::OrganisationsController < ApplicationController
The model is not in an admin folder though.
I come accross an issue when I want to edit the organisation with a
URL such as ...
http://localhost:3000/admin/organisations/1/edit
The error is
NoMethodError in Admin/organisations#edit
Showing app/views/admin/organisations/edit.html.erb where line #3
raised:
undefined method `organisation_path'' for
#<ActionView::Base:0x23c84ec>
Extracted source (around line #3):
1: <h1>Editing organisation</h1>
2:
3: <% form_for(@organisation) do |f| %>
4: <%= f.error_messages %>
5:
6: <p>
I would be amazingly grateful if anyone knows how to fix this!
Thanks
Richard.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Try <% form_for [:admin, @organization] do |f| %> HTH On 10/14/10 5:40 AM, Creative Technologist wrote:> Hi, > > Very fustrating problem. > > I''ve nested by /admin bits with a namespace ... > > map.namespace :admin do |admin| > admin.resources :dashboard > map.resources :users > map.resource :session > admin.resources :organisations > end > > I''m having an issue with :organisations though. > > The controller and view are in the /admin folder and the controller''s > class definition is ... > > class Admin::OrganisationsController < ApplicationController > > The model is not in an admin folder though. > > I come accross an issue when I want to edit the organisation with a > URL such as ... > > http://localhost:3000/admin/organisations/1/edit > > The error is > > NoMethodError in Admin/organisations#edit > > Showing app/views/admin/organisations/edit.html.erb where line #3 > raised: > > undefined method `organisation_path'' for #<ActionView::Base:0x23c84ec> > > Extracted source (around line #3): > > 1: <h1>Editing organisation</h1> > 2: > 3: <% form_for(@organisation) do |f| %> > 4: <%= f.error_messages %> > 5: > 6: <p> > > > I would be amazingly grateful if anyone knows how to fix this! > > Thanks > > Richard. >-- Erol Fornoles http://github.com/Erol http://twitter.com/erolfornoles http://ph.linkedin.com/in/erolfornoles -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
That worked great, thanks. On Oct 13, 10:48 pm, Erol Fornoles <erol.forno...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Try <% form_for [:admin, @organization] do |f| %> > > HTH > > On 10/14/10 5:40 AM, Creative Technologist wrote: > > > > > Hi, > > > Very fustrating problem. > > > I''ve nested by /admin bits with a namespace ... > > > map.namespace :admin do |admin| > > admin.resources :dashboard > > map.resources :users > > map.resource :session > > admin.resources :organisations > > end > > > I''m having an issue with :organisations though. > > > The controller and view are in the /admin folder and the controller''s > > class definition is ... > > > class Admin::OrganisationsController < ApplicationController > > > The model is not in an admin folder though. > > > I come accross an issue when I want to edit the organisation with a > > URL such as ... > > >http://localhost:3000/admin/organisations/1/edit > > > The error is > > > NoMethodError in Admin/organisations#edit > > > Showing app/views/admin/organisations/edit.html.erb where line #3 > > raised: > > > undefined method `organisation_path'' for #<ActionView::Base:0x23c84ec> > > > Extracted source (around line #3): > > > 1: <h1>Editing organisation</h1> > > 2: > > 3: <% form_for(@organisation) do |f| %> > > 4: <%= f.error_messages %> > > 5: > > 6: <p> > > > I would be amazingly grateful if anyone knows how to fix this! > > > Thanks > > > Richard. > > -- > Erol Fornoleshttp://github.com/Erolhttp://twitter.com/erolfornoleshttp://ph.linkedin.com/in/erolfornoles-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
For anyone else out there with this issue, there are a couple of other
related fixes when this issue occours.
1. When using a path say to the edit page, you need to add the admin
bit in, e.g. edit_admin_organisation_path(@organisation)
2. In your controller you will need to edit the redirect code in
certain places in order for rails to generate the correct path, for
example ...
format.html { redirect_to([:admin, @organisation], :notice =>
''Organisation was successfully created.'') }
Big thanks to Erol (http://ph.linkedin.com/in/erolfornoles ) for
guiding me on this today.
On Oct 13, 10:59 pm, Creative Technologist
<rich...-DXT9u3ndKiRtdF/iL03xVL6Z9KU14Uj5tUK59QYPAWc@public.gmane.org>
wrote:> That worked great, thanks.
>
> On Oct 13, 10:48 pm, Erol Fornoles
<erol.forno...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > Try <% form_for [:admin, @organization] do |f| %>
>
> > HTH
>
> > On 10/14/10 5:40 AM, Creative Technologist wrote:
>
> > > Hi,
>
> > > Very fustrating problem.
>
> > > I''ve nested by /admin bits with a namespace ...
>
> > > map.namespace :admin do |admin|
> > > admin.resources :dashboard
> > > map.resources :users
> > > map.resource :session
> > > admin.resources :organisations
> > > end
>
> > > I''m having an issue with :organisations though.
>
> > > The controller and view are in the /admin folder and the
controller''s
> > > class definition is ...
>
> > > class Admin::OrganisationsController < ApplicationController
>
> > > The model is not in an admin folder though.
>
> > > I come accross an issue when I want to edit the organisation with
a
> > > URL such as ...
>
> > >http://localhost:3000/admin/organisations/1/edit
>
> > > The error is
>
> > > NoMethodError in Admin/organisations#edit
>
> > > Showing app/views/admin/organisations/edit.html.erb where line #3
> > > raised:
>
> > > undefined method `organisation_path'' for
#<ActionView::Base:0x23c84ec>
>
> > > Extracted source (around line #3):
>
> > > 1: <h1>Editing organisation</h1>
> > > 2:
> > > 3: <% form_for(@organisation) do |f| %>
> > > 4: <%= f.error_messages %>
> > > 5:
> > > 6: <p>
>
> > > I would be amazingly grateful if anyone knows how to fix this!
>
> > > Thanks
>
> > > Richard.
>
> > --
> > Erol
Fornoleshttp://github.com/Erolhttp://twitter.com/erolfornoleshttp://ph.linked...
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.