Hi there, I''m thinking here about this, if the controller are located inside the controllers folder, why should we name them with _controller at the end? it''ll screw with the routing system if we get the ''_controller'' out. Is there any case I put some .rb on the controllers folder without being a controller? because from my point of view, if a controller ir located inside the controllers folder, it should be a controller. So, what do you think? I was just studying rails source and this question came to my mind. Maybe it''s just nonsense, but i think that not totally. Thanks, André Luis -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Good point, we don''t do blog_model so why do we have to do blogs_controller? On Feb 7, 2008 8:36 AM, Andreh Luis <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi there, > > I''m thinking here about this, if the controller are located inside the > controllers folder, why should we name them with _controller at the end? > > it''ll screw with the routing system if we get the ''_controller'' out. > > > Is there any case I put some .rb on the controllers folder without being > a controller? because from my point of view, if a controller ir located > inside the controllers folder, it should be a controller. > > > So, what do you think? I was just studying rails source and this > question came to my mind. Maybe it''s just nonsense, but i think that not > totally. > > > Thanks, > > André Luis > -- > Posted via http://www.ruby-forum.com/. > > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
personally, i dislike multiple files with the same name in a project (ie: app/controllers/blog.rb and app/models/blog.rb) Some tabbed editor IDEs dont include paths in the tabs, which could make it somewhat confusing On Feb 6, 5:46 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Good point, we don''t do blog_model so why do we have to do blogs_controller? > > On Feb 7, 2008 8:36 AM, Andreh Luis <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > > > > > > > Hi there, > > > I''m thinking here about this, if the controller are located inside the > > controllers folder, why should we name them with _controller at the end? > > > it''ll screw with the routing system if we get the ''_controller'' out. > > > Is there any case I put some .rb on the controllers folder without being > > a controller? because from my point of view, if a controller ir located > > inside the controllers folder, it should be a controller. > > > So, what do you think? I was just studying rails source and this > > question came to my mind. Maybe it''s just nonsense, but i think that not > > totally. > > > Thanks, > > > André Luis > > -- > > Posted viahttp://www.ruby-forum.com/. > > -- > Ryan Bigghttp://www.frozenplague.net > Feel free to add me to MSN and/or GTalk as this email.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
That''s not the case, I mean, you are forced to use _controller. Yes, files with the same name sounds confusing. But it is redundant to call _controller, when you are inside of the controller''s folder, like Ryan said, we don''t have a blog_model. I think that the controllers'' names should be more flexible. it''s just my what I''m thinking, of course we can find a lot reasons to let the _controller stay. All the .rb on the controllers folder are controllers anyway. Reacher wrote:> personally, i dislike multiple files with the same name in a project > (ie: app/controllers/blog.rb and app/models/blog.rb) Some tabbed > editor IDEs dont include paths in the tabs, which could make it > somewhat confusing-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Andreh Luis wrote:> That''s not the case, I mean, you are forced to use _controller. > > Yes, files with the same name sounds confusing. > But it is redundant to call _controller, when you are inside of the > controller''s folder, like Ryan said, we don''t have a blog_model. > > I think that the controllers'' names should be more flexible. > it''s just my what I''m thinking, of course we can find a lot reasons to > let the _controller stay. > > All the .rb on the controllers folder are controllers anyway. > > > Reacher wrote: >> personally, i dislike multiple files with the same name in a project >> (ie: app/controllers/blog.rb and app/models/blog.rb) Some tabbed >> editor IDEs dont include paths in the tabs, which could make it >> somewhat confusingI believe its a namespace issue, can''t have multiple classes with the the same name. Just a guess. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
It wouldn''t BE with the same name if people named their controllers correctly! It''s not blog_controller, its blogs_controller. Meaning the class would be Blogs and not Blog! I''m all for this idea. -- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''ll second the idea that it is a namespace issue. That would also explain why we have blog_helper and blog_test and blog_spec in their respective folders. On this note though, how dose everyone feel about the talk in the core to move application.rb to application_controller.rb? (http:// groups.google.com/group/rubyonrails-core/browse_thread/thread/ 24364f3ed58bb77b?hl=en) I think the reasoning behind that change will answer Andreh''s question. On Feb 7, 7:45 am, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> It wouldn''t BE with the same name if people named their controllers > correctly! It''s not blog_controller, its blogs_controller. Meaning the class > would be Blogs and not Blog! I''m all for this idea. > -- > Ryan Bigghttp://www.frozenplague.net > Feel free to add me to MSN and/or GTalk as this email.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Rick DeNatale
2008-Feb-07 16:01 UTC
Re: Every controller has to be ended with _controller?
On 2/7/08, Russ Jones <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I believe its a namespace issue, can''t have multiple classes with the > the same name. Just a guess.Not in the same module/class, and since models, and controllers. are in the outermost ruby namespace, they have to have different names. but there''s a further reason, I think. Or actually two. 1) Rails uses the convention of mapping names in context, so, for example in a routes.rb, map.x /url :controller => ''foo'' means that the controller class is FooController 2) Rails autoloading. Note that Rails doesn''t require you to use ''require'' to load code. When FooController is mentioned in running code, and it hasn''t been loaded, rails catches the exception raised by the missing constant and looks for the code by searching for a fill in one of the directories on the load path named ''foo_controller.rb'' -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/ --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
yes, if you take a look at routing.rb at rails source you''ll see that it searches for all .rb files in the controller directory that ends with _controller.rb. What I had in mind when I post this topic was that I was forced to use the _controller at the end, even knowing that all the .rb files located there would be controllers. Knowing that all the files there are controllers, why put the controller? Ok, using the _controller is a good thing to maintain control of the Controllers, and I agree with that. and keep about namespace too, having many files with ''same'' names isn''t good. It could be a mess. about application.rb, I asked myself why application hasn''t the _controller at the end. I think that is take all the _controllers out, or put the _controller at every controller, even application. following the talk in rails core, I found this ticket http://dev.rubyonrails.org/ticket/10570 about application.rb not following tha name convention, and it''s consequences. Thanks. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---