removed old methods to create tags
This commit is contained in:
parent
14017bfa66
commit
d0c1d488fc
|
@ -196,7 +196,6 @@ end
|
|||
|
||||
def add_entry
|
||||
entry = TableEntry.new(table_entry_params)
|
||||
create_get_table_tags(entry)
|
||||
entry.save
|
||||
entry.fix_have_data
|
||||
table = UTable.find(params[:table_entry][:u_table_id])
|
||||
|
@ -222,7 +221,6 @@ end
|
|||
|
||||
def update_entry
|
||||
entry = TableEntry.find(params[:id])
|
||||
create_get_table_tags(entry)
|
||||
entry.update_attributes(table_entry_params)
|
||||
entry.fix_have_data # when new column insert
|
||||
table = entry.u_table
|
||||
|
@ -322,27 +320,4 @@ end
|
|||
params.require(:table_entry).permit!
|
||||
end
|
||||
|
||||
def create_get_table_tags(entry,new_tags=nil)
|
||||
if new_tags.nil?
|
||||
new_tags = params["table_tags"].split(",")
|
||||
end
|
||||
tags = []
|
||||
entry.table_tags = []
|
||||
new_tags.each do |tag|
|
||||
if is_uuid?(tag) === false
|
||||
tt = TableTag.new
|
||||
tt.u_table_id = entry.u_table.id
|
||||
tt.title = tag.downcase.strip
|
||||
tt.save
|
||||
entry.table_tags << tt
|
||||
else
|
||||
tt = TableTag.find(tag)
|
||||
entry.table_tags << tt
|
||||
end
|
||||
end
|
||||
return tags
|
||||
end
|
||||
def is_uuid?(str)
|
||||
!!(str =~ /\A[\da-f]{24}\z/i || str =~ /\A[\da-f]{8}-([\da-f]{4}-){3}[\da-f]{12}\z/i)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue