ruby on rails 會話系統

  1 [email protected]:~/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 [email protected]:~/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_lock‘
100 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1132:in `block in migrate‘
101 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1301:in `with_advisory_lock‘
102 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1132:in `migrate‘
103 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:1006:in `up‘
104 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/migration.rb:984:in `migrate‘
105 /usr/local/lib/ruby/gems/2.2.0/gems/activerecord-5.0.2/lib/active_record/tasks/database_tasks.rb:161:in `migrate‘
106 /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 `call‘
108 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute‘
109 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `each‘
110 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute‘
111 /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‘
112 /usr/local/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize‘
113 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain‘
114 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke‘
115 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task‘
116 /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‘
117 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `each‘
118 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level‘
119 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads‘
120 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level‘
121 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:80:in `block in run‘
122 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling‘
123 /usr/local/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:77:in `run‘
124 /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 `load‘
126 /usr/local/bin/rake:23:in `<main>‘
127 Tasks: TOP => db:migrate
128 [email protected]:~/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 [email protected]:~/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 `start‘
172     from /usr/local/lib/ruby/gems/2.2.0/gems/railties-5.0.2/lib/rails/commands/console_helper.rb:9:in `start‘
173     from /usr/local/lib/ruby/gems/2.2.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:78:in `console‘
174     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 `require‘
177     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `block in require‘
178     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in `load_dependency‘
179     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `require‘
180     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 `load‘
182     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `block in load‘
183     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in `load_dependency‘
184     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `load‘
185     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/commands/rails.rb:6:in `call‘
186     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/command_wrapper.rb:38:in `call‘
187     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:191:in `block in serve‘
188     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:161:in `fork‘
189     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:161:in `serve‘
190     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:131:in `block in run‘
191     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:125:in `loop‘
192     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:125:in `run‘
193     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 `require‘
195     from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require‘
196     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 `start‘
203     from /usr/local/lib/ruby/gems/2.2.0/gems/railties-5.0.2/lib/rails/commands/console_helper.rb:9:in `start‘
204     from /usr/local/lib/ruby/gems/2.2.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:78:in `console‘
205     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 `require‘
208     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `block in require‘
209     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in `load_dependency‘
210     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `require‘
211     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 `load‘
213     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `block in load‘
214     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in `load_dependency‘
215     from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `load‘
216     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/commands/rails.rb:6:in `call‘
217     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/command_wrapper.rb:38:in `call‘
218     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:191:in `block in serve‘
219     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:161:in `fork‘
220     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:161:in `serve‘
221     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:131:in `block in run‘
222     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:125:in `loop‘
223     from /usr/local/lib/ruby/gems/2.2.0/gems/spring-2.0.1/lib/spring/application.rb:125:in `run‘
224     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 `require‘
226     from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require‘
227     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> 
时间: 2024-10-13 00:28:09

ruby on rails 會話系統的相关文章

第五章 系統調用

1. 系統調用的作用 爲用戶空間提供了一種硬件的抽象接口.如Linux的“萬物皆文件”的思想,APP讀取文件不用關心磁盤或者文件系統的類型 保證系統的穩定和安全.因爲內核是作爲Hardware跟APP之間的中間人,可以避免APP不正確地使用Hardware,竊取其他進程的資源,或其他危害系統的事情. 實現多任務和虛擬內存的需要 2. 在Linux中,系統調用是除了異常和陷入之外,用戶空間訪問kernel的唯一手段. 3. 系統調用在出現錯誤的時候C庫會把錯誤碼寫入errno全局變量.通過調用pe

操作系統3-內存管理(頁面置換算法)

操作系統3-內存管理(頁面置換算法) 7. 頁面置換算法 在上一節講過, 換入換出頁面要根據特定的算法來執行, 這種算法就是頁面置換算法. 不合適的算法可能會使系統發生抖動,所謂抖動即指剛剛換出的頁面又要換回來,換回來不久又要換出去,這樣就導致系統的大部分工作時間都花在了頁面調度上,導致效率不高. 下面是幾種常見的頁面置換算法: 7.1 先入先出頁面置換算法 顧名思義,根據隊列的數據結構的思想,總是將內存存在最久的頁面先換出. 7.2 最近最久未使用頁面置換算法(Least Recently U

用FineReport報表系統構建重慶江津區疾病預防控制信息系統

前言 一場自下而上的改革嘗試 這篇文章剛開始動筆的時候,恰逢剛接到衛生部專家即將來津對我區基本公共衛生服務以及一系中轉項目的工作現況.資金使用情況進行檢查的通知.誠然我區的工作現況不便在此進行評說,但是,做為迎檢的大頭戲――「國家基本公共衛生服務項目」 ――也是我國公共衛生制度建設的重要組成部分,卻一直以來都是困繞各級衛生行政部門和基層醫療機構老大難問題:各種讓人眼花潦亂的考核指標.紛繁複雜的業務流程,再加上沒有可以參考的工作模式以及各自為戰的軟體.平台,工作的開展難度和進展可見一斑. 雖然今年

諾基亞定制的Android系統名為 Z Launcher

N1這款產品似乎沒有諾基亞的傳統風格,搭載Android系統以及酷似iPad mini的外觀,都在向外界傳遞著一個信號:諾基亞在變化.不過,沒有了移動設備部門的諾基亞,仍然心系消費電子市場,N1會是個好的轉捩點嗎? 回到產品本身,N1的品質到底如何?IBTimes 就在第一時間帶來了上手體驗门禁读卡器,稱它是一個很不錯的“iPad 替代選擇”. 設計   N1在尺寸上和iPad mini一致,配備 7.9 英寸螢幕.不止如此,耳機孔.音量鍵.攝像頭甚至底部的揚聲器,二者都幾乎設計在了相同位置.就

操作系統3-處理機調度與死鎖(死鎖)

操作系統-處理機調度與死鎖3(死鎖) 7.死鎖問題 死鎖是指多個進程等待其它進程佔有的資源,因而無限期等待下去的局面. 系統發生死鎖時,一定具備以下四個條件: 互斥條件.對於一個排他性資源,某一時刻最多允許一個進程佔有. 佔有且申請條件.進程至少已佔有一個資源,又要申請新的資源.此時該進程阻塞,且在等待過程中不釋放已經佔有的資源. 不可搶佔條件.進程獲得的資源在未使用之前,其他進程不得搶佔該資源. 環路條件.若干個進程相互要佔有彼此的資源,形成一個環路. 8.死鎖的避免 要避免死鎖,分為靜態策略

如何讓Android系統顯示CJK擴展區漢字

由於一些特殊需要,需要在個人設備上顯示CJK擴展區漢字,經多方詢問並驗證,找到了一下辦法,暫總結如下. 一.電腦上顯示 在電腦(Windows,Linux,Mac等系統)上可以通過安裝「花園明朝字體」,讓電腦/PC顯示擴展區的漢字.八卦符號.麻將符號等.截止2015年8月,Unicode已經發展到了Unicode8.0,8.0版本收錄了80,388個漢字. 『1』.花園明朝字體:目前收錄97,745字. 『2』.CJK擴展區漢字:CJK統一表意文字/CJK Unified Ideographs/

如何从 0 开始学 ruby on rails (漫步版)

如何从 0 开始学 ruby on rails (漫步版) ruby 是一门编程语言,ruby on rails 是 ruby 的一个 web 框架,简称 rails. 有很多人对  rails 感兴趣,但又不知道从何下手.学习路线是什么,因为在多个场合下回答过类似问题,所以决定整理成文章供大家参观. 有很多人选择直接学习 rails,在学习使用 rails 的过程中学习 ruby.但我觉得这有些本末倒置,我更推崇先学 ruby 再学 rails,在对 ruby 有了一定的了解后再学 rails

用FineReport報表系統構建財政資金和公共資金監管系統

一.應用背景 在電子化的社會,政府作為國家的權力中心和社會管理機構,在加入WTO後,將實現從管理型到管理服務型的轉變.政府機構在管理和規範國家政治經濟活動之外,將藉助強大的網路技術,把更多的時間和精力,投入到社會公眾服務中去.社會信息資源和各種政策法規不再會塵封庫中或者層層傳達,而將通過網路在第一時間與公眾會面,通過網路,政府可以廣納賢言,迅速了解社會政治經濟的發展動態,甚至是來自社會最底層的信息,並以此做出及時準確的決策,這對更好的促進經濟建設和社會穩定,好處不言而喻.按照地方政府機關提出推進

作業系統的類型

依處理方式而分 整批處理作業系統(Batch processing OS) 處理方式:將欲處理的資料或程式整批集中,置於如卡片.紙帶.磁帶.磁碟等儲存在媒體內,當要處理時,CPU才會到媒體中讀取資料後加以處理. 優點:整批處理作業系統是第一代作業系統,比起沒有作業系統時,更有效地改進了電腦的作業效率,減少大部份人工操作的比率. 缺點:因為CPU速度遠較存取資料的I/O為快,所以此方式CPU常被閒置,效率低. 分時作業系統(Time-sharing OS) 處理方式:CPU每次分配給各程序式(pr