随笔分类 -  rails

摘要:环境 ubuntu 14.04为了安装rails4.2 和 ruby 2.2.2,这是目前稳定的最新版本,需要先安装rvmsudo apt-get updatesudo apt-get install curl\curl -L https://get.rvm.io | bash -s stable ... 阅读全文
posted @ 2015-07-11 01:29 juandx 阅读(235) 评论(0) 推荐(0) 编辑
摘要:make it more easy afterhttp://www.cnblogs.com/juandx/p/4058399.html1 if you want the selected is what you choose after you submit the form use javascr... 阅读全文
posted @ 2014-11-16 01:15 juandx 阅读(611) 评论(0) 推荐(0) 编辑
摘要:utf-8必须置顶,如果放在其他位置,会导致后面如果遇到中文无法解析,然后报其他乱七八糟的错误,比如不能连接数据库,比如语法错误。。。。。。这种错误不好找,切记!!!出错代码:#!/bin/env ruby $: << '/var/lib/gems/1.9.1/gems/librrd-1.0.4/e... 阅读全文
posted @ 2014-11-11 14:45 juandx 阅读(211) 评论(0) 推荐(0) 编辑
摘要:使用select来选择,,,选择就响应真是花了好大的功夫。。。。你妹。。。在controller设置变量来储存选择后的值。。。js中如果select选择为空那么传入的值是””而不是nullselectedIndex的值都是数字,从0开始,而不是option的值controller#sdn的网络流量监... 阅读全文
posted @ 2014-10-29 00:28 juandx 阅读(1849) 评论(0) 推荐(0) 编辑
摘要:一篇看到的讲解得不错的文章 http://blog.csdn.net/clskkk2222/article/details/6735365这里还有一些例子:Rake DocumentationRails Rake TutorialUsing the Rake Building Language===... 阅读全文
posted @ 2014-09-10 22:12 juandx 阅读(1445) 评论(0) 推荐(0) 编辑
摘要:在render中,即使有:action,那么也仅仅是取对应的view中的模板(html.erb)而已,所以这里即使浏览器中的url是/orders/xcreate,但是显示的界面是/app/views/orders/xshow的代码 def xcreate flash.now[:notice... 阅读全文
posted @ 2014-09-10 15:35 juandx 阅读(562) 评论(0) 推荐(0) 编辑
摘要:link_to和其对应要跳转的的url,用path和直接路由方法看看link_to "alert(1)"} %> 在rake routes中看到,定义好的路由是:C:\Users\Administrator\Desktop\lianxizhong\lianxi1_form_f... 阅读全文
posted @ 2014-09-09 17:32 juandx 阅读(1479) 评论(0) 推荐(0) 编辑
摘要:原创,转载请注明http://www.cnblogs.com/juandx/p/3963023.htmlrails中path、url路径解析,routes信息,form_for剖析,link_to示例1、首先要了解routes中resources的member、collection、new的关系 =... 阅读全文
posted @ 2014-09-09 17:11 juandx 阅读(3424) 评论(0) 推荐(0) 编辑
摘要:D3js技术文档概述 D3 allows you to bind arbitrary data to a Document Object Model (DOM), and then apply data-driven transformations to the document. For exam... 阅读全文
posted @ 2014-09-06 22:34 juandx 阅读(20760) 评论(14) 推荐(0) 编辑
摘要:d3js拓扑关系特效可视化展现在上一篇d3js文档http://www.cnblogs.com/juandx/p/3959900.html中讲了简单的d3js方法和效果,现在我做一个完整的演示,使用d3js来展现动态可视化的网络拓扑效果图,希望对大家有所帮助。 D3 Page Templa... 阅读全文
posted @ 2014-09-06 22:32 juandx 阅读(21297) 评论(0) 推荐(0) 编辑
摘要:注意在代码中用/表示路径。。。windows中file才是\1、 x="0" y="0" height="30px" width="30px"/> (1)在html中科院直接用嵌入式的方式获得rails中的图片。比如这里的图片放在\app\assets\images\vnet\virtual_sw... 阅读全文
posted @ 2014-09-06 21:55 juandx 阅读(824) 评论(0) 推荐(0) 编辑
摘要:#虚拟网络拓扑的json数据 def topodata #@vnic = Vnic.all #flash.now[:notice] = 'Message sent!' #flash.now[:alert] = 'Message sent!' simple_json = { nodes:... 阅读全文
posted @ 2014-09-04 15:46 juandx 阅读(932) 评论(0) 推荐(0) 编辑
摘要:tASSOC means the => operator 阅读全文
posted @ 2014-09-04 12:19 juandx 阅读(134) 评论(0) 推荐(0) 编辑
摘要:实现json、做出提示框1、在controller中使用flash.now[:alert] = "str"方法来做printdef topodata #@vnic = Vnic.all #flash.now[:notice] = 'Message sent!' #flash.now[:aler... 阅读全文
posted @ 2014-09-04 00:25 juandx 阅读(454) 评论(0) 推荐(0) 编辑
摘要:class SwitchesController [:index, :show] def index end def show end #存储拓扑 def topo @vts = VmToSwitch.all @sts = SwitchToSwitch.all @st... 阅读全文
posted @ 2014-08-07 02:44 juandx 阅读(453) 评论(0) 推荐(0) 编辑
摘要:rails nameerror uninitialized constant classwill occur if your rails console is not loaded with configuration of the class file containing method bein... 阅读全文
posted @ 2014-08-05 22:24 juandx 阅读(777) 评论(0) 推荐(0) 编辑
摘要:之前先在initializers 文件夹下建立了一个task.rb ,rails服务启动的时候执行,本地没问题,可是服务器上启动了3个进程,会执行3遍,解决方法是 把task.rb 放到 script/文件夹下,然后在项目根目录执行 ruby script/task.rb production &。... 阅读全文
posted @ 2014-08-05 21:53 juandx 阅读(372) 评论(0) 推荐(0) 编辑
摘要:把database.yml的adapter改为mysql2把Gemfile文件中的gem mysql改为gem mysql2 阅读全文
posted @ 2014-08-05 16:23 juandx 阅读(135) 评论(0) 推荐(0) 编辑
摘要:file是以_开头命名的文件,比如_cart.html.erb这样就可以用render来调用了还可以传参数比如rails 2.0p87传一个集合render(:partial => "cart_item", :collection => @cart.items)这样局部模板就得到了一个变量如cart... 阅读全文
posted @ 2014-08-05 01:55 juandx 阅读(517) 评论(0) 推荐(0) 编辑
摘要:web敏捷开发 p317depot > ruby script/console>>rs = ActionController::Routing::routes可以简单测试比如>>puts rs.routes>>rs.recognize_path "/store">>rs.generate :cont... 阅读全文
posted @ 2014-08-04 23:39 juandx 阅读(356) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示