码迷,mamicode.com
首页 > Web开发 > 详细

json flash.now[:notice] flash.now[:alert]

时间:2014-09-04 01:32:07      阅读:240      评论:0      收藏:0      [点我收藏+]

标签:des   for   数据   sp   html   on   c   ef   htm   

#虚拟网络拓扑json数据
def topodata
#@vnic = Vnic.all
#flash.now[:notice] = ‘Message sent!‘
#flash.now[:alert] = ‘Message sent!‘
@vnic = {
nodes: [{ name: ‘bob‘, age: "22", awesome: "true" }, { name: ‘bob‘, age: 22, awesome:true }],
links: [{ name: ‘bob‘, age: "22", awesome: "true" }, { name: ‘bob‘, age: 22, awesome:true }]
}
flash.now[:alert] = @vnic
respond_to do |format|
format.html
format.json { render json: @vnic } #这里会自动调用to_json
end
end

json flash.now[:notice] flash.now[:alert]

标签:des   for   数据   sp   html   on   c   ef   htm   

原文地址:http://www.cnblogs.com/juandx/p/3955103.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!