On Apr 5, 11:32 pm, Cesar
<cesarepare...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi, I''m developing my first rails project in Netbeans, with rails
2.1,
> I used scaffold to generate my models, views and controllers.
> The problem I''m having is that when I define a new method inside a
> controller i can not access it using a "normal" url like
/controller/
> action
> Instead, it can only be accessed by using a /controller/action/id kind
> of url. If i use the /controler/action url it goes to the "show"
> controller and throws an error.
>
Have a look at the :member and :collection options to map.resources
(or have a look at the routing guide http://guides.rubyonrails.org/routing.html
)
Fred> Example: if I define this test1 method in users controllers It can
> only be accesed by /users/test1/someid
> instead of my desired /users/test1
> class UsersController < ApplicationController
>
> def test1
> flash[:notice] = "Entre a login"
> end
> #here go all other scaffolded methods
> end
>
> I think it must have something to do with my routing, which is
> configured like this...
>
> ActionController::Routing::Routes.draw do |map|
> map.resources :users
> map.connect '':controller/:action/:id''
> map.connect '':controller/:action/:id.:format''
> end
>
> Please someone help me, thanks!
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---