On Sat, Jun 26, 2010 at 10:35 AM, RailsFan Radha <li...@ruby-forum.com> wrote:

>  I have just got a simple db and has been fiddling around this for the
> past week or so.

Aside from the fact that you would have been better off letting Rails
create your DB via migrations instead of creating it by hand -- you're
making this much more difficult than it is.

Your previous example doesn't adhere to Rails conventions:

anyway, here is the table name, category.
# should be named 'categories'
columns:
category_id int
# should be 'id'
parent_category_id int
category_title  varchar(50)
category_short_desc  varchar (100)
category_long_desc  varchar(255)
dt_created  datetime
# should be 'created_at'
dt_modified  datetime
# should be 'update_at'
user_created varchar(45)
user_modified   varchar(45)
status varchar(1)

Then just create your model class, e.g. in app/models/category.rb

class Category < ActiveRecord::Base
end

:: and you're done.

It would probably help you to create a trivial app via scaffolding just
to see examples of Rails-convention models, controllers, etc.

FWIW,
-- 
Hassan Schroeder ------------------------ hassan.schroe...@gmail.com
twitter: @hassan

-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to