As stated, I am new to rails, and Runy for that matter. I am working on a simple project to get acquainted and wanted to use ruby code in index.html, I changed the name to .rhtml and added the following simple code: <% link_to ''Artists'', :action => ''list'' %> This works great in my view files, but in the index.rhtml file, not so much. The error is: "uninitialized constant WelcomeController" What should I be doing differently? Thanks, Mike --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
You shouldn''t be using the index.html file in the public folder inside your application''s root directory. This is just something to display for when you have nothing at the beginning. In your config/routes.rb I''m guessing you''ve defined something like: map.connect '''', :controller => "welcome" Because that is what''s commented out by default in the config/routes.rb file. The error you''re getting is generated from Rails looking for a controller file called "welcome_controller.rb" in app/controllers, the file is not there and Rails throws a nice error. To generate the controller type script/generate controller welcome. As of Rails 2.0 controller names should be pluralized. This is extremely helpful for when you get to "RESTful Routing" because typing out stuff like new_post_comment_path is much better than :controller => "comments", :action => "new", :post_id => depending on what kind of application you''re making, think of what the first object should be and pluralize the name, and type script/generate controller <object''s pluralized name>. You will also need to generate a model for your object, and this name should be singular. On Dec 11, 2007 10:21 AM, Mike <prattm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > As stated, I am new to rails, and Runy for that matter. I am working > on a simple project to get acquainted and wanted to use ruby code in > index.html, I changed the name to .rhtml and added the following > simple code: > > <% link_to ''Artists'', :action => ''list'' %> > > This works great in my view files, but in the index.rhtml file, not so > much. The error is: > > "uninitialized constant WelcomeController" > > What should I be doing differently? > > Thanks, > > Mike > > >-- Ryan Bigg http://www.frozenplague.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Are you advising dont use index.html at all? I got rid of the standard one and made my own but maybe that wont work. I have 3 tables with model, view, and controller files setup as needed. I just want a start page that allows me to summarize the tables (counts, etc.) and provide links into their views. Is it best to create some new object called "start"? Thanks for quick response! Mike On Dec 10, 7:08 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You shouldn''t be using the index.html file in the public folder inside your > application''s root directory. This is just something to display for when you > have nothing at the beginning. > > In your config/routes.rb I''m guessing you''ve defined something like: > > map.connect '''', :controller => "welcome" > > Because that is what''s commented out by default in the config/routes.rb > file. > > The error you''re getting is generated from Rails looking for a controller > file called "welcome_controller.rb" in app/controllers, the file is not > there and Rails throws a nice error. To generate the controller type > script/generate controller welcome. > > As of Rails 2.0 controller names should be pluralized. This is extremely > helpful for when you get to "RESTful Routing" because typing out stuff like > new_post_comment_path is much better than :controller => "comments", :action > => "new", :post_id => > > depending on what kind of application you''re making, think of what the first > object should be and pluralize the name, and type script/generate controller > <object''s pluralized name>. You will also need to generate a model for your > object, and this name should be singular. > > On Dec 11, 2007 10:21 AM, Mike <pra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > As stated, I am new to rails, and Runy for that matter. I am working > > on a simple project to get acquainted and wanted to use ruby code in > > index.html, I changed the name to .rhtml and added the following > > simple code: > > > <% link_to ''Artists'', :action => ''list'' %> > > > This works great in my view files, but in the index.rhtml file, not so > > much. The error is: > > > "uninitialized constant WelcomeController" > > > What should I be doing differently? > > > Thanks, > > > Mike > > -- > Ryan Bigghttp://www.frozenplague.net--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Perhaps going through a few screencasts might give you a better idea of how Rails works. http://www.akitaonrails.com/2007/12/10/the-first-rails-2-0-screencast-english http://railscasts.com On Dec 11, 2007 12:47 PM, Mike <prattm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Are you advising dont use index.html at all? I got rid of the > standard one and made my own but maybe that wont work. I have 3 > tables with model, view, and controller files setup as needed. I just > want a start page that allows me to summarize the tables (counts, > etc.) and provide links into their views. Is it best to create some > new object called "start"? > > Thanks for quick response! > > Mike > > On Dec 10, 7:08 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > You shouldn''t be using the index.html file in the public folder inside > your > > application''s root directory. This is just something to display for when > you > > have nothing at the beginning. > > > > In your config/routes.rb I''m guessing you''ve defined something like: > > > > map.connect '''', :controller => "welcome" > > > > Because that is what''s commented out by default in the config/routes.rb > > file. > > > > The error you''re getting is generated from Rails looking for a > controller > > file called "welcome_controller.rb" in app/controllers, the file is not > > there and Rails throws a nice error. To generate the controller type > > script/generate controller welcome. > > > > As of Rails 2.0 controller names should be pluralized. This is extremely > > helpful for when you get to "RESTful Routing" because typing out stuff > like > > new_post_comment_path is much better than :controller => "comments", > :action > > => "new", :post_id => > > > > depending on what kind of application you''re making, think of what the > first > > object should be and pluralize the name, and type script/generate > controller > > <object''s pluralized name>. You will also need to generate a model for > your > > object, and this name should be singular. > > > > On Dec 11, 2007 10:21 AM, Mike <pra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > As stated, I am new to rails, and Runy for that matter. I am working > > > on a simple project to get acquainted and wanted to use ruby code in > > > index.html, I changed the name to .rhtml and added the following > > > simple code: > > > > > <% link_to ''Artists'', :action => ''list'' %> > > > > > This works great in my view files, but in the index.rhtml file, not so > > > much. The error is: > > > > > "uninitialized constant WelcomeController" > > > > > What should I be doing differently? > > > > > Thanks, > > > > > Mike > > > > -- > > Ryan Bigghttp://www.frozenplague.net > > >-- Ryan Bigg http://www.frozenplague.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---