up up....
anybody can help?
thanks
On 18 Apr, 18:49, pingala
<ping...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi,
>
> quite new to rails and ruby... so still wondering how does it
> work.. ;)
>
> i have three tables structured as follow:
> 1) categories
> 2) recipes
> 3) steps
>
> where
> steps belongs_to recipe
> recipes belongs_to category
>
> and
> category has_many recipes
> recipe has_many steps
>
> i''ve created the standard scaffold for the three above...
everything
> went ok,
> i''ve modified the models for the constraints on the FKs,
i''ve modified
> the views
> to add a select dropdown to show in the recipe edit/new form the
> categories, and
> in the step edit/new form the recipes.
>
> in the _form.rhtml for recipes i''ve:
> <%= select("recipe", "category_id",
Category.find(:all).collect {|c|
> [c.name, c.id] }) %></p>
>
> and in case of editing it shows the right category preselected.
>
> in the _form.rhtml for steps i''ve:
> <%= select("step", "recipe_id",
Recipe.find(:all).collect {|c|
> [c.title, c.id] }) %></p>
>
> in this case the preselection doesn''t work...
>
> now to create a step inside a recipe i''ve a link in the main
recipe
> edit/show page like that:
> <%= link_to "Create new Step", {:controller =>
"step", :action =>
> "new", :recipe_id => @recipe} %>
>
> that create a link like this one (assuming i''m viewing the recipe
> id#2):http://localhost:3000/step/new?recipe_id=2
>
> hope i''m clear enough... how all this can works? what i''m
doing wrong?
> what''s the logic to follow?
>
> thanks for any suggestion
> really appreciated.
>
> KR,
> Pingala
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---