I'm pretty new to rails and I've created a method in posts_controller.rb that contains the following
def update_feeds
Post.get_feeds -- works via console
@rss_feedsTab = "/admin/posts"
redirect_to @rss_feedsTab, :notice => 'Feeds Updated successfully'
end
and trying to make it fire in my view with:
<%= link_to 'Update Feeds', :controller => "posts", :action => "update_feeds", :method=>:post %>
and I get a routing error:
No route matches {:action=>"update_feeds", :method=>:post, :controller=>"admin/posts"}
I'm really not grasping how this whole routing works at all, any help would be appreciated :)
CONTROLLER=posts rake routes:
admin_post GET /admin/posts/:id(.:format) admin/posts#show
PUT /admin/posts/:id(.:format) admin/posts#update
DELETE /admin/posts/:id(.:format) admin/posts#destroy
GET /admin/posts(.:format) admin/posts#index {:collection=>{:update_feeds=>:post}}
POST /admin/posts(.:format) admin/posts#create {:collection=>{:update_feeds=>:post}}
GET /admin/posts/new(.:format) admin/posts#new {:collection=>{:update_feeds=>:post}}
GET /admin/posts/:id/edit(.:format) admin/posts#edit {:collection=>{:update_feeds=>:post}}
GET /admin/posts/:id(.:format) admin/posts#show {:collection=>{:update_feeds=>:post}}
PUT /admin/posts/:id(.:format) admin/posts#update {:collection=>{:update_feeds=>:post}}
DELETE /admin/posts/:id(.:format) admin/posts#destroy {:collection=>{:update_feeds=>:post}}
routes.rb
namespace :admin do
resources :users,:videos,:posts,:links,:rss_feeds
resources :posts, :collection => {:update_feeds => :post}
end