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
<[email protected]>wrote:

>
>
> On Tue, Jun 21, 2011 at 7:21 AM, Chirag Singhal 
> <[email protected]>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| %>
>
>
>   <div class="field">
>     <%= f.label :name %><br />
>     <%= f.text_field :name %>
>   </div>
>   <div class="field">
>     <%= f.label :title %><br />
>     <%= f.text_field :title %>
>   </div>
>   <div class="field">
>     <%= f.label :content %><br />
>     <%= f.text_area :content %>
>   </div>
>
> <div align="center">
>
>   <div class="actions">
>     <%= f.submit %>
>   </div>
> </div>
> <div class="field">
>     <%= f.label :sign %><br />
>     <%= f.text_field :sign %>
>   </div>
> <div class="field">
>     <%= f.label :value %><br />
>     <%= f.text_field :value %>
>
>   </div>
> <% end %>
>
> <%= submit_tag "Test me!", :type => 'button', :onclick => 'alert("It 
> works!")' %>
> <br>
> <%= 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>



-- 
Chirag
http://sumeruonrails.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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to