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 %>

diff --git a/app/views/glossary_terms/index.html.erb b/app/views/glossary_terms/index.html.erb index 69d96a2..8daead8 100644 --- a/app/views/glossary_terms/index.html.erb +++ b/app/views/glossary_terms/index.html.erb @@ -7,20 +7,28 @@ + + <% @glossary_terms.each do |term| %> - - - - + + + + + + <% end %>
# <%=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 %> +
diff --git a/app/views/glossary_terms/show.html.erb b/app/views/glossary_terms/show.html.erb index 85a366b..e7a805a 100644 --- a/app/views/glossary_terms/show.html.erb +++ b/app/views/glossary_terms/show.html.erb @@ -9,6 +9,10 @@

<%= @term.name %>

+ + +
<%=l :field_category %><%= @term.category.try!(:name) %> +
<%=l :field_description %> <%= @term.description %>