diff --git a/app/controllers/glossary_terms_controller.rb b/app/controllers/glossary_terms_controller.rb index b60ac9a..b31f7eb 100644 --- a/app/controllers/glossary_terms_controller.rb +++ b/app/controllers/glossary_terms_controller.rb @@ -47,7 +47,7 @@ class GlossaryTermsController < ApplicationController def glossary_term_params params.require(:glossary_term).permit( - :name, :description + :name, :description, :category_id ) end end diff --git a/app/views/glossary_terms/_form.html.erb b/app/views/glossary_terms/_form.html.erb index e3da80d..b1e5e7f 100644 --- a/app/views/glossary_terms/_form.html.erb +++ b/app/views/glossary_terms/_form.html.erb @@ -1,4 +1,5 @@
<%= form.text_field :name, size: 80, required: true %>
+<%= form.collection_select :category_id, GlossaryCategory.all, :id, :name, include_blank: true %>
<%= form.text_area :description, size: "80x10", required: false %>
# | <%=l :field_name %> | +<%=l :field_category %> | <%=l :field_description %> |
---|---|---|---|
- <%= link_to term.name, term %> - | -- <%= term.description %> - | -||
+ <%= term.id %> + | ++ <%= link_to term.name, term %> + | ++ <%= term.category.try!(:name) %> + | ++ <%= term.description %> + | +
<%=l :field_category %> | +<%= @term.category.try!(:name) %> + |
---|---|
<%=l :field_description %> | <%= @term.description %> |