Me estoy volviendo medio loco.

Tengo un controller: UserFilesController, el cual tiene sus métodos y todo anda.
Ahora bien, le agrego un método, myfiles, y no logro hacer que arme la ruta.

Asumo que es un problema de routeo porque este es el error:

 ActionController::RoutingError in Articles#index

Showing app/views/layouts/application.html.erb where line #30 raised:

No route matches {:controller=>"user_file", :action=>"myfiles",
:id=>"4574524e72defc919903ff9e2c972f18"}

Extracted source (around line #30):

27:                                     <% if session[:user_id] == nil %>
28:                                             <%= link_to "Login", "/login" 
%><br>
29:                                     <% else %>
30:                                             <%= link_to "Logout 
(#{session[:user_name]})", "/logout" %><br><br>
31:                                             <%= link_to "My Files", 
:controller => "user_file", :action
=> "myfiles", :id => session[:user_id] %><br>
32:                                             <%= link_to "My Articles", 
"???" %><br>
33:                                     <% end %>

También porque cuando pongo:

                <%= link_to "My Files", myfiles_user_files_path %>

No anda tampoco (undefined local variable or method `myfiles_user...)

Este es el routes.db es:

ActionController::Routing::Routes.draw do |map|
  # we go to articles first, we'll what the index page is later
  map.root :controller => "articles"

  # first we construct nested routes. with this we can reach
  # comments directly (/comments/:id and /comments/:id/comments)
  # but only limited to [ show, edit, update, destroy]
  # creating comments is only through controllers with possible
  # discussion.
  map.resources :articles do |article|
    article.resources :comments, :name_prefix => "article_"
  end
  map.resources :user_files, :member => {:attachment => :get} do |user_file|
    user_file.resources :comments, :name_prefix => "user_file_"
  end
  map.resources :comments, :only => [ :show, :edit, :update, :destroy]
do |comment|
    comment.resources :comments, :only => [ :show, :edit, :update,
:destroy, :create, :index, :new], :name_prefix => "comments_"
  end

  # login/logout are actions from the users controller. but like this
  # they don't expose anything of the internals to outsiders.
  map.resources :users
  map.login '/login', :controller => 'users', :action => 'login'
  map.logout '/logout', :controller => 'users', :action => 'logout'

  # See how all your routes lay out with "rake routes"
end

Esto debe ser algo pavísimo.

Bueno, desde ya les agradezco.
_______________________________________________
Ruby mailing list
[email protected]
http://lista.rubyargentina.com.ar/listinfo.cgi/ruby-rubyargentina.com.ar

Responder a