码迷,mamicode.com
首页 > 其他好文 > 详细

ruby on rails 會話系統

时间:2017-03-30 13:44:52      阅读:329      评论:0      收藏:0      [点我收藏+]

标签:measure   rate   console   init   limit   irb   action   aop   fine   

  1 caopu@caopu-ThinkPad-X1:~/demo$ rake db:migrate
  2 == 20170329075038 CreateUsers: migrating ======================================
  3 -- create_table(:users)
  4 rake aborted!
  5 StandardError: An error has occurred, all later migrations canceled:
  6 
  7 undefined method `varchar for #<ActiveRecord::ConnectionAdapters::MySQL::TableDefinition:0x005575be9f04f0>
  8 /home/caopu/demo/db/migrate/20170329075038_create_users.rb:5:in `block in change  9 /home/caopu/demo/db/migrate/20170329075038_create_users.rb:3:in `change 10 NoMethodError: undefined method `varchar for #<ActiveRecord::ConnectionAdapters::MySQL::TableDefinition:0x005575be9f04f0>
 11 /home/caopu/demo/db/migrate/20170329075038_create_users.rb:5:in `block in change 12 /home/caopu/demo/db/migrate/20170329075038_create_users.rb:3:in `change 13 Tasks: TOP => db:migrate
 14 (See full trace by running task with --trace)
 15 caopu@caopu-ThinkPad-X1:~/demo$ rake db:migrate --trace
 16 ** Invoke db:migrate (first_time)
 17 ** Invoke environment (first_time)
 18 ** Execute environment
 19 ** Invoke db:load_config (first_time)
 20 ** Execute db:load_config
 21 ** Execute db:migrate
 22 == 20170329075038 CreateUsers: migrating ======================================
 23 -- create_table(:users)
 24 rake aborted!
 25 StandardError: An error has occurred, all later migrations canceled:
 26 
 27 undefined method `varchar for #<ActiveRecord::ConnectionAdapters::MySQL::TableDefinition:0x0055a9ab79da38>
 28 /home/caopu/demo/db/migrate/20170329075038_create_users.rb:5:in `block in change 29 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:272:in `create_table 30 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:423:in `create_table 31 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:846:in `block in method_missing 32 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:815:in `block in say_with_time 33 /usr/local/lib/ruby/2.2.0/benchmark.rb:288:in `measure 34 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:815:in `say_with_time 35 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:835:in `method_missing 36 /home/caopu/demo/db/migrate/20170329075038_create_users.rb:3:in `change 37 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:789:in `exec_migration 38 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:773:in `block (2 levels) in migrate 39 /usr/local/lib/ruby/2.2.0/benchmark.rb:288:in `measure 40 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:772:in `block in migrate 41 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:398:in `with_connection 42 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:771:in `migrate 43 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:951:in `migrate 44 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1214:in `block in execute_migration_in_transaction 45 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1284:in `ddl_transaction 46 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1213:in `execute_migration_in_transaction 47 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1185:in `block in migrate_without_lock 48 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1184:in `each 49 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1184:in `migrate_without_lock 50 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1132:in `block in migrate 51 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1301:in `with_advisory_lock 52 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1132:in `migrate 53 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1006:in `up 54 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:984:in `migrate 55 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/tasks/database_tasks.rb:161:in `migrate 56 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/railties/databases.rake:58:in `block (2 levels) in <top (required)> 57 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `call 58 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute 59 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `each 60 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute 61 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain 62 /usr/local/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize 63 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain 64 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke 65 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task 66 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level 67 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `each 68 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level 69 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads 70 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level 71 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:80:in `block in run 72 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling 73 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:77:in `run 74 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)> 75 /usr/local/bin/rake:23:in `load 76 /usr/local/bin/rake:23:in `<main> 77 NoMethodError: undefined method `varchar for #<ActiveRecord::ConnectionAdapters::MySQL::TableDefinition:0x0055a9ab79da38>
 78 /home/caopu/demo/db/migrate/20170329075038_create_users.rb:5:in `block in change 79 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:272:in `create_table 80 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:423:in `create_table 81 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:846:in `block in method_missing 82 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:815:in `block in say_with_time 83 /usr/local/lib/ruby/2.2.0/benchmark.rb:288:in `measure 84 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:815:in `say_with_time 85 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:835:in `method_missing 86 /home/caopu/demo/db/migrate/20170329075038_create_users.rb:3:in `change 87 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:789:in `exec_migration 88 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:773:in `block (2 levels) in migrate 89 /usr/local/lib/ruby/2.2.0/benchmark.rb:288:in `measure 90 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:772:in `block in migrate 91 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:398:in `with_connection 92 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:771:in `migrate 93 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:951:in `migrate 94 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1214:in `block in execute_migration_in_transaction 95 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1284:in `ddl_transaction 96 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1213:in `execute_migration_in_transaction 97 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1185:in `block in migrate_without_lock 98 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1184:in `each 99 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1184:in `migrate_without_lock100 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1132:in `block in migrate101 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1301:in `with_advisory_lock102 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1132:in `migrate103 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1006:in `up104 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:984:in `migrate105 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/tasks/database_tasks.rb:161:in `migrate106 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/railties/databases.rake:58:in `block (2 levels) in <top (required)>107 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `call108 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute109 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `each110 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute111 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain112 /usr/local/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize113 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain114 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke115 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task116 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level117 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `each118 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level119 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads120 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level121 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:80:in `block in run122 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling123 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:77:in `run124 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>125 /usr/local/bin/rake:23:in `load126 /usr/local/bin/rake:23:in `<main>127 Tasks: TOP => db:migrate
128 caopu@caopu-ThinkPad-X1:~/demo$ rake db:migrate --trace
129 ** Invoke db:migrate (first_time)
130 ** Invoke environment (first_time)
131 ** Execute environment
132 ** Invoke db:load_config (first_time)
133 ** Execute db:load_config
134 ** Execute db:migrate
135 == 20170329075038 CreateUsers: migrating ======================================
136 -- create_table(:users)
137    -> 0.2420s
138 == 20170329075038 CreateUsers: migrated (0.2423s) =============================
139 
140 ** Invoke db:_dump (first_time)
141 ** Execute db:_dump
142 ** Invoke db:schema:dump (first_time)
143 ** Invoke environment 
144 ** Invoke db:load_config 
145 ** Execute db:schema:dump
146 caopu@caopu-ThinkPad-X1:~/demo$ rails c
147 Running via Spring preloader in process 29556
148 Loading development environment (Rails 5.0.2)
149 irb(main):001:0> a=User.new
150 => #<User id: nil, name: nil, password: nil, created_at: nil, updated_at: nil>
151 irb(main):002:0> a.name="admin"
152 => "admin"
153 irb(main):003:0> a.password =
154 irb(main):004:0* 
155 irb(main):005:0* a.password =
156 irb(main):006:0* a.password =""
157 => ""
158 irb(main):007:0> a.password ="123456"
159 => "123456"
160 irb(main):008:0> a.save
161    (0.4ms)  BEGIN
162   SQL (0.7ms)  INSERT INTO `users` (`name`, `password`, `created_at`, `updated_at`) VALUES (admin, 123456, 2017-03-29 10:33:54, 2017-03-29 10:33:54)
163    (53.8ms)  COMMIT
164 => true
165 irb(main):009:0> a
166 => #<User id: 1, name: "admin", password: "123456", created_at: "2017-03-29 10:33:54", updated_at: "2017-03-29 10:33:54">
167 irb(main):010:0> User.where({:name=>})
168 SyntaxError: (irb):10: syntax error, unexpected }
169 User.where({:name=>})
170                     ^
171     from /usr/local/lib/ruby/gems/2.2.0/gems/railties-5.0.2/lib/rails/commands/console.rb:65:in `start172     from /usr/local/lib/ruby/gems/2.2.0/gems/railties-5.0.2/lib/rails/commands/console_helper.rb:9:in `start173     from /usr/local/lib/ruby/gems/2.2.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:78:in `console174     from /usr/local/lib/ruby/gems/2.2.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:49:in `run_command!175     from /usr/local/lib/ruby/gems/2.2.0/gems/railties-5.0.2/lib/rails/commands.rb:18:in `<top (required)>176     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `require177     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `block in require178     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in `load_dependency179     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `require180     from /home/caopu/demo/bin/rails:9:in `<top (required)>181     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `load182     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `block in load183     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in `load_dependency184     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `load185     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/commands/rails.rb:6:in `call186     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/command_wrapper.rb:38:in `call187     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:191:in `block in serve188     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:161:in `fork189     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:161:in `serve190     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:131:in `block in run191     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:125:in `loop192     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:125:in `run193     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application/boot.rb:19:in `<top (required)>194     from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require195     from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require196     from -e:1:in `<main>197 irb(main):011:0> 
198 irb(main):012:0* User.where({:name=>"admin",:password=>})
199 "SyntaxError: (irb):12: syntax error, unexpected ‘}‘
200 User.where({:name=>"admin",:password=>})
201                                        ^
202     from /usr/local/lib/ruby/gems/2.2.0/gems/railties-5.0.2/lib/rails/commands/console.rb:65:in `start203     from /usr/local/lib/ruby/gems/2.2.0/gems/railties-5.0.2/lib/rails/commands/console_helper.rb:9:in `start204     from /usr/local/lib/ruby/gems/2.2.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:78:in `console205     from /usr/local/lib/ruby/gems/2.2.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:49:in `run_command!206     from /usr/local/lib/ruby/gems/2.2.0/gems/railties-5.0.2/lib/rails/commands.rb:18:in `<top (required)>207     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `require208     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `block in require209     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in `load_dependency210     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `require211     from /home/caopu/demo/bin/rails:9:in `<top (required)>212     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `load213     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `block in load214     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in `load_dependency215     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `load216     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/commands/rails.rb:6:in `call217     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/command_wrapper.rb:38:in `call218     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:191:in `block in serve219     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:161:in `fork220     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:161:in `serve221     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:131:in `block in run222     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:125:in `loop223     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:125:in `run224     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application/boot.rb:19:in `<top (required)>225     from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require226     from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require227     from -e:1:in `<main>228 irb(main):013:0> User.where({:name=>"admin",:password=>"123456"}).first
229   User Load (1.2ms)  SELECT  `users`.* FROM `users` WHERE `users`.`name` = admin AND `users`.`password` = 123456 ORDER BY `users`.`id` ASC LIMIT 1
230 => #<User id: 1, name: "admin", password: "123456", created_at: "2017-03-29 10:33:54", updated_at: "2017-03-29 10:33:54">
231 irb(main):014:0> User.where({:name=>"admin",:password=>"123456"}).first
232   User Load (0.8ms)  SELECT  `users`.* FROM `users` WHERE `users`.`name` = admin AND `users`.`password` = 123456 ORDER BY `users`.`id` ASC LIMIT 1
233 => #<User id: 1, name: "admin", password: "123456", created_at: "2017-03-29 10:33:54", updated_at: "2017-03-29 10:33:54">
234 irb(main):015:0> User.where({:name=>"admin",:password=>"1234561"}).first
235   User Load (0.8ms)  SELECT  `users`.* FROM `users` WHERE `users`.`name` = admin AND `users`.`password` = 1234561 ORDER BY `users`.`id` ASC LIMIT 1
236 => nil
237 irb(main):016:0> User.where({:name=>"admin",:password=>"123456"}).first
238   User Load (0.7ms)  SELECT  `users`.* FROM `users` WHERE `users`.`name` = admin AND `users`.`password` = 123456 ORDER BY `users`.`id` ASC LIMIT 1
239 => #<User id: 1, name: "admin", password: "123456", created_at: "2017-03-29 10:33:54", updated_at: "2017-03-29 10:33:54">
240 irb(main):017:0> 

 

ruby on rails 會話系統

标签:measure   rate   console   init   limit   irb   action   aop   fine   

原文地址:http://www.cnblogs.com/lanboy/p/6645366.html

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