Added ability to comment on license records; updated item list view to link to the item display pages

This commit is contained in:
2022-12-09 11:42:12 -05:00
parent 36f7fb82a6
commit db6bfe8e7a
7 changed files with 62 additions and 2 deletions

View File

@ -1,5 +1,5 @@
class License < Sequel::Model
one_to_many :license_comments
end

View File

@ -0,0 +1,5 @@
class LicenseComment < Sequel::Model
many_to_one :licenses
end

View File

@ -92,3 +92,12 @@ get '/license/:license_id' do
:license => license
}
end
post '/license/:license_id/comment' do
license = License.first(id: params[:license_id])
comment = LicenseComment.create(body: params[:comment_body])
license.add_license_comment(comment)
redirect "/license/#{license.id}"
end