RoR
iteye_16188
这个作者很懒,什么都没留下…
展开
-
[转]rake db命令
[url]http://www.douban.com/note/92737624/[/url]db:create 用config\database.yml中的定义创建当前 RAILS_ENV 项目环境下的数据库 db:create:all 用config\database.yml中的定义创建所有数据库 db:drop 删除当前 RAILS_ENV项目环境中的数据库 db...原创 2015-06-10 01:16:42 · 161 阅读 · 0 评论 -
rails spring command
[url]https://github.com/rails/spring[/url]Brief Totally automatic; no need to explicitly start and stop the background process Reloads your application code on each run Restarts you...原创 2015-08-11 10:02:30 · 97 阅读 · 0 评论 -
ruby class attribute
[code="ruby"][1] pry(main)> class A[1] pry(main)* class :show_a[2] pry(main)> A.set_a(100)=> 100[3] pry(main)> A.show_a=> 100[4] pry(main)> A.a=> 100[5] pry(main)>[/code]原创 2015-08-10 15:15:52 · 225 阅读 · 0 评论 -
How Ruby Uses Memory
[url]http://www.sitepoint.com/ruby-uses-memory/[/url]原创 2015-08-10 13:44:28 · 90 阅读 · 0 评论 -
Ruby on Rails inverse_of
[url]http://viget.com/extend/exploring-the-inverse-of-option-on-rails-model-associations[/url]原创 2015-08-05 10:21:25 · 137 阅读 · 0 评论 -
mongoid without function
[code="ruby"]ms = MainClass.where({"uuid":"5be8c2c3-9812-4ab8-82dd-50827791e385"}).without(:_id, "classes._id", "classes.sub_classess._id", "classes.sub_classes.actions._id")ms.each do |m|原创 2015-08-04 10:51:50 · 150 阅读 · 0 评论 -
ruby on rails connection two database
reference:[url]http://geekhmer.github.io/blog/2015/02/07/ruby-on-rails-connect-to-multiple-databases-and-migrations/[/url]config/mongoid.yml[code="xml"]db1: development: sessions...原创 2015-07-29 16:14:50 · 147 阅读 · 0 评论 -
create ruby hash using block
[code="ruby"]irb(main):016:0> @command = beginirb(main):017:1* Hash.new{|h, k| h[k] = Array.new}irb(main):018:1> end=> {}irb(main):019:0> @command[:a]=> []irb(main):020:0> @command=> {...原创 2015-07-28 15:27:28 · 112 阅读 · 0 评论 -
Ruby on Rails concern
[color=red][quote]The Rails Concern are used to DRYING the code for both models and controllers.So just by including the module,either in model/controller you get the methods and you can call them jus...原创 2015-07-27 17:02:41 · 187 阅读 · 0 评论 -
ruby on rails rake task
for mongoid, since it doesn't support rake db:migrate and rake db:drop will drop all tables, so if we need to drop some of tables in database, I will the following code.1. [color=blue]rails g task...原创 2015-07-13 15:46:49 · 242 阅读 · 0 评论 -
create rake task
1. rails g task my_namespace my_task1 my_task22. under lib/tasks/ folder, there will be file with the name of my_namespace.rake3. coding in the rake file:[code="ruby"]namespace :my_namespace d...原创 2015-07-08 11:55:35 · 107 阅读 · 0 评论 -
rails g scaffold Error
rails g scaffold[color=darkblue]Error: root/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.8/lib/bundler/runtime.rb:34:in `block in setup': You have already activated spring 1.3.6, but...原创 2015-05-19 21:03:31 · 112 阅读 · 0 评论