Hi,
I’m trying to generate a new action and is very confused by the error
message I get. I am accessing http://localhost:3001/members/isactive/
and get this error message:
ActiveRecord::RecordNotFound in MembersController#show
Couldn’t find Member with ID=isactive
How come? Shouldn’t I get the isactive action + view?
/Fredrik
–
“Give up learning, and put an end to your troubles.”
Frerik,
We can’t see the web server running on your local machine (localhost:
3001). You’ll need to provide a code sample…
Ken
you’re using restful routing and you haven’t set up a route for isactive
yet.
On Tue, Mar 4, 2008 at 9:18 AM, Ken [email protected] wrote:
/Fredrik
–
“Give up learning, and put an end to your troubles.”
–
Ryan B.
Feel free to add me to MSN and/or GTalk as this email.
On 3/4/08, Fredrik K. [email protected] wrote:
map.resources :members
map.connect ‘:controller/:action/:id’
map.connect ‘:controller/:action/:id.:format’
end
which does not seem to include my case. But, how do I fix this? Adding
map.connect ‘:controller/:action’ either above or below the last
default cases does nothing, and
You need to add a custom route. Remove your ‘map.resources :members’
and replace it with:
map.resources :members, :collection => { :inactive => :any }
replace :any with either :get or :post, depending upon how you want to
access it (or leave it as :any to allow either :get or :post)
Hi,
Ok, this may very well be a routing problem, but I fail to do
something about it. My config/routes.rb
contained just the default
ActionController::Routing::Routes.draw do |map|
map.resources :members
map.resources :members
map.connect ‘:controller/:action/:id’
map.connect ‘:controller/:action/:id.:format’
end
which does not seem to include my case. But, how do I fix this? Adding
map.connect ‘:controller/:action’ either above or below the last
default cases does nothing, and
I cannot get an explicit
map.connect ‘members/inactive’, :controller => ‘members’, :action =>
‘inactive’
to get me anywere. RoR wants to map the last entry to “id” rather than
action.
BTW, adding a fake ID, as in http://localhost:3001/members/inactive/1,
works
/Fredrik
On Tue, Mar 4, 2008 at 3:28 AM, Ryan B. (Radar)
[email protected] wrote:
3001). You’ll need to provide a code sample…
Feel free to add me to MSN and/or GTalk as this email.
–
“Give up learning, and put an end to your troubles.”
You can find RESTful Rails documentation everywhere on the net via
google. I found these two PDF documents on it for you:
http://www.b-simple.de/download/restful_rails_en.pdf
the second is a cheatsheet, so it’s concise and contains only
essential examples
Exellent!
This did the trick. Now, where do I learn about these new routes?
/Fredrik
On Tue, Mar 4, 2008 at 7:45 AM, Mike G. [email protected] wrote:
map.resources :members
–
“Give up learning, and put an end to your troubles.”