Displaying 1 result from an estimated 1 matches for "tbval".
Did you mean:
bval
2013 Mar 21
0
how to remove changed_attributes from yaml response
...etails in
my response.
build Model code
class Test < ActiveRecord::Base
attr_accessor: t_1, t_2, t_3, t_4
end
In Test Controller code:
#build is controller object
tb = ["[5, 30.14]","[0, 12.0]","[1, 11.0]","[2, 11.0]"]
$i=1
while $i <= tb.length do
$tbVal = "t_#{$i}"
build["#{$tbVal}"] = tb[$i-1]
$i += 1
wants.yaml { render :text => tb.to_yaml, :content_type =>
"application/x-yaml", :layout => layout}
Ouput:
--- ! ruby/object:Test
attributes:
build_1: "[5, 30.14]"
build_2: "[0, 12.0]"
build...