There is a screencast on this topic at
Http://www.rubyplus.org
Free Ruby & Rails screencasts
On Feb 13, 2008, at 10:24 PM, Dave Anderson
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org
> wrote:
>
> I''m creating a restful (for the most part) website that is
read-only
> from a user perspective, but has an admin section where content is
> generated. I would like to do something like the following for this
> admin portion:
>
> http://www.mysite.com/admin/[controller]
>
> I''ve ran into several stumbling blocks and after 2 days, have not
> found
> a solution. I started by creating a namespace.
>
> map.namespace(:admin) do |admin|
> admin.resources :categories
> admin.resources :sections
> admin.resources :items
> end
>
> I then used these commands to generate the right resources:
>
> script/generate resource admin/category title:string
> script/generate resource admin/section title:string
> category:references
> script/generate resource admin/item title:string, section:references
>
> Using this approach, I had controllers, models, and views created in
> an
> ''admin'' directory within each appropriate folder. Few
questions so
> far...
>
> (1) Having namespaced models seems like a bad practice. Yet, when I
> reconfigure them to not be namespaced, other resource routing fails
> such
> as creating a link like:
>
> <% for category in @categories %>
> <%= link_to "show category" category %>
> <% end %>
>
> (2) When trying to run functional tests on controllers within the
> ''admin'' namespace, I get all kinds of errors. Since the
fixtures are
> in
> ''admin/<fixture>'' within the
''test'' directory, Rails doesn''t know to
> look there. I''ve found no way to configure that and moving it
outside
> the ''admin'' only makes the problem worse. So despite my
user interface
> working, I cannot write any tests to validate it in this
> configuration.
>
> I could really use some help, this issue is now breaching about 2 days
> of effort with no results. Has anyone had similar problems or can
> anyone
> offer some potential strategies to make this work?
>
> I really appreciate anyons help. Thanks in advance.
> --
> Posted via http://www.ruby-forum.com/.
>
> >
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---