Added ability to comment on license records; updated item list view to link to the item display pages
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
class License < Sequel::Model
|
||||
|
||||
|
||||
one_to_many :license_comments
|
||||
|
||||
end
|
||||
|
5
lib/models/license_comment.rb
Normal file
5
lib/models/license_comment.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class LicenseComment < Sequel::Model
|
||||
|
||||
many_to_one :licenses
|
||||
|
||||
end
|
@ -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
|
||||
|
Reference in New Issue
Block a user