Routes, sqlite3

I have two different questions, I hope that's not a problem, if it is, I
do two differents topics, sorry.

First, I would like to delete a table of sqlite3. The problem is that I
had a table cathegories created, but I delete the code. Now I created a
new model cathegories and when I do the rake, it says I already have the
table cathegories created but I cannot use it I don't know why, I cannot
acces to that table with sqlite3...:S I think I could add a migration
and drop table, migrate, and then start again with another migration
creating columns, but I would like to delete the table from sqlite3 and
then create from 0 the cathegories model.

Next issue is (important one) about asociations and routes.
If I have comments that belongs to cathegory, the action would see like:

@post = Post.find(:post_id)
@comment = @post.comments.find(:id)

Ok, and in form_for it would be like: form_for([@post, @form])

Now, If I have a model cathegory and, obvious, posts belongs_to
cathegory. With a route

map.resources :cathegories :has_many => {:posts => :comments}, :shallow
=> true

Then, Have I to do that? Is it correct?Is it necessary?:

@cathegory = Cathegory.find(:cathegory_id)
@post = @cathegory.posts.find(:post_id)
@comment = @post.comments.find(:id)

and the form: form_for([@cathegory, @post, @comment]) ??
Is that what I have to do?

With that route created, for example this routes would be ok?:

post_path(@cathegory, @post)
edit_comment_path(@cathegory, @post, @comment)

Yes, I'm a little bit (?) confused with the basics yet, I'm learning it
now, and routes and asociations can make the life easier, but when you
master it xD

Thank You very much

Protos Jack wrote:

[...]

First, I would like to delete a table of sqlite3. The problem is that I
had a table cathegories created, but I delete the code. Now I created a
new model cathegories and when I do the rake, it says I already have the
table cathegories created but I cannot use it I don't know why, I cannot
acces to that table with sqlite3...:S

So you deleted the table from the DB, but Rails still thinks it's there?
If that's the case, your schema.rb file is probably out of sync with the
DB. Try rake db:schema:dump to fix it...and then use migrations to
manipulate your DB in future, so that this won't happen again!

I think I could add a migration
and drop table, migrate, and then start again with another migration
creating columns, but I would like to delete the table from sqlite3 and
then create from 0 the cathegories model.

Migrations are the way to go.
Also note correct spelling of "categories".

Best,

Protos Jack wrote:

Thanks, but, about the first topic?

Sorry, I meant second