Re: uninitialized constant ApplicationController

Chirag Singhal
2011-06-21T11:55:02Z

All your routes will need to change as per the named scope

new_post_path should be changed to new_admin_post_path

form_for(@post) should be changed to form_for [:admin, @post]

and so on

Check rake:routes for the full list of new routes with the namescope



On Tue, Jun 21, 2011 at 5:08 PM, amritpal pathak
<amritpalpathak1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:

>
>
> On Tue, Jun 21, 2011 at 7:21 AM, Chirag Singhal
<chirag.singhal-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:
>
>> Yes. Create a new directory "admin" under app/views and move
"posts"
>> directory into that one.
>> again bad luck.I did as you said.
>> new error
>>
>
> ActionController::RoutingError in Admin/posts#index
>
> Showing */home/amrit/check/app/views/admin/posts/index.html.erb* where
> line *#2* raised:
>
> No route matches {:controller=>"posts",
:action=>"new"}
>
> I did everything as previous before namespacing ,it was working.The file
new.html.erb exist in same directory.This file looks :
>
>
> <%= link_to ''New Post'', new_post_path%>
> <%= form_for(@post) do |f| %>
>
>
>
> <%= f.label :name %>
>     <%= f.text_field :name %>
>
>
> <%= f.label :title %>
>     <%= f.text_field :title %>
>
>
> <%= f.label :content %>
>     <%= f.text_area :content %>
>
>
>
>
>
>     <%= f.submit %>
>
>
>
> <%= f.label :sign %>
>     <%= f.text_field :sign %>
>
>
> <%= f.label :value %>
>     <%= f.text_field :value %>
>
>
> <% end %>
>
> <%= submit_tag "Test me!", :type =>
''button'', :onclick => ''alert("It
works!")'' %>
>
> <%= submit_tag "Click me", :type =>
''button'' %>
> <%= button_to "Great", :action => "click"%>
>  <%= button_to "click me", :action => "work"%>
>
>
>         here if i removed 1st time just to test ,the next line gives the
error:
>
> No route matches {:controller=>"posts"}
>
>                I think we are missing something to add or else.
>
> thanks
>
> amritpalpathakgne.wordpress.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-/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.
>



--
Chirag