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
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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@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