First, my schema looks like this:
create_table "categories", force: :cascade do |t|
t.text "name"
t.text "slug"
end
create_table "fields", force: :cascade do |t|
t.integer "order"
t.string "title"
t.text "tipo"
t.text "values"
t.integer "sub_category_id"
end
add_index "fields", ["sub_category_id"], name: "index_fields_on_sub_category_id"
create_table "sub_categories", force: :cascade do |t|
t.integer "category_id"
t.text "name"
t.text "slug"
end
add_index "sub_categories", ["category_id"], name: "index_sub_categories_on_category_id"
This is my schema, a category has many sub_categories, and a sub_category has many fields. Im trying to generate a view which contains all fields of a specific sub_category, i've already passed the sub_category.id to this view, but thats all i could do.
Its not that difficult i imagine, but im a begginer on rails. How can i do it? The routes are also a problem, since i have to create a new controller function. But the route generated by my application already looks like this: "/sub_categories/mysubcategory56/visualizeform?sub_category=56"
Aucun commentaire:
Enregistrer un commentaire