我有这个字符串
{{contact.info}}
Run Code Online (Sandbox Code Playgroud)
该值是:
name teste\nteste@teste.com.br\n(11) 11111-1111\n(0) 12312-3123\n(12) 12312-3123\n
Run Code Online (Sandbox Code Playgroud)
在 html 我想看到它:
name teste
teste@teste.com.br<br>
(11) 11111-1111
(10) 12312-3123
(12) 12312-3123
Run Code Online (Sandbox Code Playgroud)
有什么办法吗?
我有两个表,例如:
table_one n x 1 table_two
Run Code Online (Sandbox Code Playgroud)
但是,table_two有许多table_one元素。
楷模:
class TableOne < ActiveRecord::Base
belongs_to :table_two
end
class TableTwo < ActiveRecord::Base
has_many :tables_one, class_name 'TableOne'
end
Run Code Online (Sandbox Code Playgroud)
我想table_one在table_two更新之前自动删除其中的所有元素(之前)
ps:或者,正确的位置在table_one.table_two.delete_all哪里?
更新1
该命令:
table_two = TableTwo.last
table_two.tables_one = [TableOne.new(<attributes>), TableOne.new(<attributes>, TableOne.new(<attributes>]
table_two.save
Run Code Online (Sandbox Code Playgroud)
应该删除table_two中所有现有的table_one,然后添加三个新的table_one。