Ruby on start page?

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 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 [email protected] wrote:

“uninitialized constant WelcomeController”

What should I be doing differently?

Thanks,

Mike


Ryan B.
http://www.frozenplague.net

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

Perhaps going through a few screencasts might give you a better idea of
how
Rails works.


http://railscasts.com

On Dec 11, 2007 12:47 PM, Mike [email protected] wrote:

Mike

map.connect ‘’, :controller => “welcome”
As of Rails 2.0 controller names should be pluralized. This is extremely
<object’s pluralized name>. You will also need to generate a model for

on a simple project to get acquainted and wanted to use ruby code in
What should I be doing differently?

Thanks,

Mike


Ryan B.http://www.frozenplague.net


Ryan B.
http://www.frozenplague.net

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs