diff --git a/app/views/comments/_form.haml b/app/views/comments/_form.haml index e19c201..a653619 100644 --- a/app/views/comments/_form.haml +++ b/app/views/comments/_form.haml @@ -15,6 +15,6 @@ = form.check_box :published .field = form.label :dependency_id - = form.text_field :dependency_id + = form.select :dependency_id, Dependency.all.map { |d| [d.name, d.id]} .actions = form.submit diff --git a/app/views/comments/index.haml b/app/views/comments/index.haml index 2a392e0..c667073 100644 --- a/app/views/comments/index.haml +++ b/app/views/comments/index.haml @@ -12,9 +12,10 @@ %tr %td= comment.body %td= comment.published - %td= comment.dependency + %td= comment.dependency.name %td= link_to "Show", comment %td= link_to "Edit", edit_comment_path(comment) %td= link_to "Destroy", comment, method: :delete, data: { confirm: "Are you sure?" } %br = link_to "New Comment", new_comment_path += link_to "Back to dependencies", dependencies_path diff --git a/app/views/comments/show.haml b/app/views/comments/show.haml index 4bdf313..1d369ca 100644 --- a/app/views/comments/show.haml +++ b/app/views/comments/show.haml @@ -7,7 +7,7 @@ = @comment.published %p %strong Dependency: - = @comment.dependency + = @comment.dependency.name = link_to "Edit", edit_comment_path(@comment) | = link_to "Back", comments_path diff --git a/app/views/dependencies/index.haml b/app/views/dependencies/index.haml index 5e1e1fa..2821332 100644 --- a/app/views/dependencies/index.haml +++ b/app/views/dependencies/index.haml @@ -9,8 +9,11 @@ - @dependencies.each do |dependency| %tr %td= dependency.name + %td= "#{dependency.comments.count} #{Comment.model_name.human(count: dependency.comments.count)}" %td= link_to "Show", dependency %td= link_to "Edit", edit_dependency_path(dependency) %td= link_to "Destroy", dependency, method: :delete, data: { confirm: "Are you sure?" } %br = link_to "New Dependency", new_dependency_path += link_to "New Comment", new_comment_path += link_to "See Comments", comments_path diff --git a/config/locales/en.yml b/config/locales/en.yml index 63f1c3e..9d5d870 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1 +1,6 @@ en: + activerecord: + models: + comment: + one: comment + other: comments