Could someone explain me how to work with routes and namespaces? I need to understand it urgent to build an application. Thanks! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/aFVOeUZzVUlsUUFK. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
http://guides.rubyonrails.org/routing.html On Jun 1, 2011, at 10:13 AM, Vinícius Rodrigues wrote:> Could someone explain me how to work with routes and namespaces? > I need to understand it urgent to build an application. > Thanks! > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/aFVOeUZzVUlsUUFK. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.Cordialmente, Fábio Rodriguez (Brajola) Analista de Sistemas / Systems Analyst brajola-mzAlzpHaUBBBDgjK7y7TUQ@public.gmane.org brajola-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
I did so: match ''home'' => ''home#index'' namespace :payable do resources :account end root :to => ''home#index'' I can access the route home/index, but can not access the route payable /accounts/index, he finds Payable::AccountsController but says he does notfind the :id => ''index'' Could someone explain me? Thanks! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/QjJTNW90QWtYa3NK. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi, try add the following: match '':controller(/:action(/:id))''> match ''home'' => ''home#index'' > > namespace :payable do > resources :account > end > > root :to => ''home#index''On Jun 1, 2011, at 10:30 AM, Vinícius Rodrigues wrote:> I did so: > > match ''home'' => ''home#index'' > > namespace :payable do > resources :account > end > > root :to => ''home#index'' > > I can access the route home/index, but can not access the route payable/accounts/index, he finds Payable::AccountsController but says he does not find the :id => ''index'' > > Could someone explain me? > Thanks! > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/QjJTNW90QWtYa3NK. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.Cordialmente, Fábio Rodriguez (Brajola) Analista de Sistemas / Systems Analyst brajola-mzAlzpHaUBBBDgjK7y7TUQ@public.gmane.org brajola-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Actually my last line reads: Sisteger::Application.routes.draw do match ''home'' => ''home#index'' namespace :payable do resources :account end root :to => ''home#index'' match '':controller(/:action(/:id(.:format)))'' end I generated the model and controller as follows: rails g model Payable/Account rails g controller Payable/Accounts This is right? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/QXd5dGZNMVlEelVK. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
You don''t need to do rails g model Payable/Account just Account works On Jun 1, 2011, at 10:50 AM, Vinícius Rodrigues wrote:> Actually my last line reads: > > Sisteger::Application.routes.draw do > > match ''home'' => ''home#index'' > > namespace :payable do > resources :account > end > > root :to => ''home#index'' > > match '':controller(/:action(/:id(.:format)))'' > > end > > I generated the model and controller as follows: > > rails g model Payable/Account > > rails g controller Payable/Accounts > > This is right? > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/QXd5dGZNMVlEelVK. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.Cordialmente, Fábio Rodriguez (Brajola) Analista de Sistemas / Systems Analyst brajola-mzAlzpHaUBBBDgjK7y7TUQ@public.gmane.org brajola-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
But I need two scenarios: Accounts Payable (Payable::AccountsController) Accounts Receivable (Receivable::AccountsController) But I can not work! :( -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/aEZzdEJQRWpiYWdK. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
So you are using the wrong syntax. You should use rails g controller Accounts/Payable, etc. Anyway, I think you are a bit confused and must organize your knowledge flow. Start reading the Getting Started from Guides, http://guides.rubyonrails.org/getting_started.html. 2011/6/1 Vinícius Rodrigues <swoopageon-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org>> But I need two scenarios: > Accounts Payable (Payable::AccountsController) > Accounts Receivable (Receivable::AccountsController) > But I can not work! :( > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/aEZzdEJQRWpiYWdK. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- S. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
You can generate just one model and set a flag with the type of Account: for MongoId: field :account_type, :type => String, :default => ''P'' And in the controllers you can search with @accounts = Account.where(:account_type => ''P'') This can solve your problem but it''s not the best way to do it. I can''t imagine a better way to do it! On Jun 1, 2011, at 11:19 AM, Vinícius Rodrigues wrote:> But I need two scenarios: > Accounts Payable (Payable::AccountsController) > Accounts Receivable (Receivable::AccountsController) > But I can not work! :( > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/aEZzdEJQRWpiYWdK. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.Cordialmente, Fábio Rodriguez (Brajola) Analista de Sistemas / Systems Analyst brajola-mzAlzpHaUBBBDgjK7y7TUQ@public.gmane.org brajola-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
I see, I thought so too. But do not think the best way But it is a solution! I''ll have to implement anyway! Thanks! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/YTQ3Q3p3Z1RGRFFK. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.