mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-30 20:23:14 +08:00
Merge pull request #1755 from mlorb/ml-sci-3349
Change author of copied inventory item [SCI-3349]
This commit is contained in:
commit
367ecba488
1 changed files with 3 additions and 2 deletions
|
@ -28,7 +28,7 @@ module RepositoryActions
|
|||
def duplicate_row(id)
|
||||
row = RepositoryRow.find_by_id(id)
|
||||
new_row = RepositoryRow.new(
|
||||
row.attributes.merge(new_row_attributes(row.name))
|
||||
row.attributes.merge(new_row_attributes(row.name, @user.id))
|
||||
)
|
||||
|
||||
if new_row.save
|
||||
|
@ -46,10 +46,11 @@ module RepositoryActions
|
|||
end
|
||||
end
|
||||
|
||||
def new_row_attributes(name)
|
||||
def new_row_attributes(name, user_id)
|
||||
timestamp = DateTime.now
|
||||
{ id: nil,
|
||||
name: "#{name} (1)",
|
||||
created_by_id: user_id,
|
||||
created_at: timestamp,
|
||||
updated_at: timestamp }
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue