Ruby on Rails Tuesday, June 28, 2011

HI

I have the issue about the route globbing in rails 3.0.9.

here is the code:

in the AccountsController:
def show2
@account = Account.first(:conditions => ['login = ? AND enabled =
?', params[:account], true])
end

config/routes.rb
match "/my/*account", :to => "accounts#show2"

rake route showed:
/my/*account
{:controller=>"accounts", :action=>"show2"}


Try to access the http://127.0.0.1:3000/my/test/ and the
log/development.log showed:

Started GET "/my/test" for xxx at Tue Jun 27 16:07:14 -0400 2011
Processing by AccountsController#show2 as HTML
Account Load (0.6ms) SELECT `accounts`.* FROM `accounts` WHERE
(login = NULL AND enabled = 1) LIMIT 1
Completed 404 Not Found in 9ms
Rendered public/404.html (1.6ms)

So the params[:account] was not set by route globbing??


Any help is appreciated.


Kind Regards


Min Wang

--
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@googlegroups.com.
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.

No comments:

Post a Comment