RoR - Some Questions Before Starting

Hello everyone,
For some time I was studying Ruby on Rails, Active Record ideology and
other thing related with RoR right now I still know a lot more about
PHP than RoR. I am almost ready to start writing websites using RoR
and get more experience. But I still have some questions before
starting and I can’t start without answers.

If you could simply answer some of them, would be great.

  1. Reading about ActiveRecord (RoR) I noticed that there are some
    special tables columns which are filled/updated automatically. These
    are a few: created_at, created_on, updated_at, updated_on. There I
    could get the full list of these columns/fields names and how
    everything works? I don’t want to write code like a blind man.

  2. Cookies could be accessed using cookies[:my_coockie], using this I
    can read/create/update cookie?

  3. The hole RoR application for me has one hole at least I think so at
    this point. The are controllers, actions but what about the main page?
    RoR firstly looks in the public directory and loads HTML or other
    files if it exists. There are index.htm(l), but how I can make dynamic
    index page? Rails/Ruby code inside index.htm(l) as I assume won’t
    work. So the first page must be only static? Or I should redirect user
    to some controller/action in index?

  4. What is test directory for? And /libs/taks? It looks like this part
    isn’t clear for me.

  5. I noticed %w[someting_inside], but what that %w does and where I
    could read more about it?

  6. Sorry for this one, but I am busy looking for some other answers
    using google and I don’t have much time. There I could find pre-
    defined variables list?

Thanks, I really appreciate for the help. I will learn it!

david wrote:

  1. Reading about ActiveRecord (RoR) I noticed that there are some
    special tables columns which are filled/updated automatically. These
    are a few: created_at, created_on, updated_at, updated_on. There I
    could get the full list of these columns/fields names and how
    everything works? I don’t want to write code like a blind man
    http://wiki.rubyonrails.org/rails/pages/MagicFieldNames

On 8/30/07, david [email protected] wrote:

  1. The hole RoR application for me has one hole at least I think so at
    this point. The are controllers, actions but what about the main page?
    RoR firstly looks in the public directory and loads HTML or other
    files if it exists. There are index.htm(l), but how I can make dynamic
    index page? Rails/Ruby code inside index.htm(l) as I assume won’t
    work. So the first page must be only static? Or I should redirect user
    to some controller/action in index?

You handle this by defining a default route in config/routes.rb and
then removing public/index.html. If you read the default
public/index.html that Rails creates, you’ll see this answered.

  1. What is test directory for? And /libs/taks? It looks like this part
    isn’t clear for me.

test is for creating your application’s tests. If you use
script/generate to generate your models and controllers, then skeleton
test fixtures and test cases are created. Rails makes TDD really easy,
so do it. :slight_smile:

lib/tasks is for creating additional Rake tasks. Any .rake files in
this directory are automatically included when you invoke Rake.

  1. I noticed %w[someting_inside], but what that %w does and where I
    could read more about it?

It’s a Ruby operator that splits the stuff inside the brackets on
whitespace and returns an array of the results. Like Perl’s qw()
operator.

You can read more about this in the Pickaxe book (Google that)

  1. Sorry for this one, but I am busy looking for some other answers
    using google and I don’t have much time. There I could find pre-
    defined variables list?

Get the Pickaxe book and “Agile Web D. with Ruby on Rails”.