ITeye博客

ROR

共 9 篇文章

rails postgreSQL schema

摘自老外的一个pg数据库schema解决方案 原帖地址: http://stackoverflow.com/questions/2782758/creating-a-multi-tenant-application-using-postgresqls-schemas-and-rails module ActionController module Routing class RouteSet def extract_request_environment(request) env = { :method => request.method } env[:domain] = request.d…

2012-07-04 13:07 · ROR · postgreSQL

ruby的复制clone、dup

转自 船长日志 , 本文链接地址: http://www.cslog.cn/Content/ruby-deep-clone/ 用Ruby复制一个对象(object)也许没有你想像的那么容易. 今天我google了半天, 做个总结吧. 先从最简单的开始, b = a 是复制吗? 看代码说话: >> a= [0,[1,2]] >> b=a >> b[0]=88 >> b[1][0]=99 >> b => [88, [99, 2]] >> a => [88, [99, 2]] 从上面代码发现, 一但修改b, 原来的a也同时被改变了. 甚至: >> b.equal?(a) => true 原来b跟a…

2012-03-27 10:27 · ROR

ror零碎

instance_of? 父类为false is_a? 父类为true ----- taint o ={:name=>"china"} o.taint o1={:subName=>"c"} o11={:subSubName=>"c11"} o1[:sub]=o11 o[:sub]=o1 oo=o.dup p o[:sub].tainted? #false p oo.tainted? #true str1="str" str2=str1.dup str1.taint p str2.tainted? #false

2012-03-26 11:16 · ROR

Rails常用命令整理

Rails常用命令整理 Ruby on Rails 2009-12-08 11:16:59 阅读247 评论0 字号:大中小 订阅 ------ GEM: gem install rails --include-dependencies gem install rails -v=2.0.2 自动安装rails ------ 1.1 创建Rails应用程序 $ rails [_VERSION_] app_name 可选项: VERSION: 指定rails的版本(如果安装了多个rails版本),VERSION前后各加一下划线, 如"_1.2.6_" -d, database=xxx 指定安装一…

2011-05-31 16:55 · ROR · SQL Server · Ruby · 数据结构 · Rails · SVN

修改rails模块实体

用脚手架创建的模块,如果修改实体,要修改数据库迁移脚以及schema.rb,另外如果运行rake db:migrate后,字段缺失的话,要删除数据库重新创建

2011-05-30 14:06 · ROR · Rails

官网例子主子表报错undefined method `post_comments_path'

按官网例子创建comment后,进入post show页面报错,解决方案如下: 修改route.rb resources :posts do resources :comments end

2011-05-27 14:30 · ROR

rails rake problems: uninitialized constant Rake::DSL

原来安装railsInstaler,里面ruby版本为1.8.7,rake版本为0.8.7,rails为3.0.6,一切正常 之后升级环境到ruby1.9.2-p180,创建完工程,运行bundle install命令,自动将rake升级到0.9.0,运行创建数据库命令:rake db:create --tace 出错 ______________________________________________________________________ D:\mylog>rake db:create --trace (in D:/mylog) rake aborted! uniniti…

2011-05-27 09:04 · ROR · C · C++ · Ruby · C# · Rails

ror基础教程

RubyGems rubygems RubyGems 是什么? RubyGems(简称 gems)是一个用于对 Rails 组件进行打包的 Ruby 打包系统。 它提供一个分发 Ruby 程序和库的标准格式,还提供一个管理程序包安装的工具。 RubyGems的功能类似于Linux下的apt-get。使用它可以方便第从远程服务器下载并安装Rails。 打开命令行窗口(cmd),输入执行命令 gem install rails --remote 或 gem install rails--include-dependencies。 _________________________________…

2011-05-26 21:19 · ROR · Ruby · Ant · Rails · 脚本 · rubygems

ruby学习

来历 Ruby的作者于1993年2月24日开始编写Ruby,直至1995年12月才正式公开发布于fj(新闻组)。之所以称为Ruby,是因为Perl的发音与6月的诞生石pearl(珍珠)相同,因此Ruby以7月的诞生石ruby( 红宝石 )命名。

2011-04-18 15:05 · ROR · Perl · Ruby