找不到表'用户'?

时间:2016-02-07 23:12:21

标签: ruby-on-rails ruby

我尽力了。我正在添加我的所有文件,请看看。

我跑了:

  • rake db:drop(删除表格)
  • rake db:create(创建数据库)
  • rake db:migrate(创建表格)
  • rake db:test:prepare(创建测试数据库)

控制器文件:

class UsersController<ApplicationController
  respond_to :html, :json

  def new
    @user = User.new  
  end

  def create
    @user = User.new(params[:user])
    if @user.save
      redirect_to root_url, notice: "Thank you for siging up!"
    else
      render "new"
    end
  end

end

我的html.erb文件。

<h1>login</h1>
<% form_for @user do |f|%>
<% if @user.errors.any? %>
<div class="error_message">
<h2>Form is invalid</h2>
<ul>
    <% @user.error.full_message.each do |message| %>
    <li><%= message%></li>
    <% end %>
   </ul>
 </div>
 <% end %>
 <div class="field">
<%= f.label  :email %><br />
<%= f.text_field :email %>
</div>
<div class="field">
<%= f.label :password %><br />
 <%= f.password_field :password %>
 </div>
 <div class="field">
   <%= f.label :password_confirmation %><br />
   <%= f.password_field :password_confirmation %>

 </div>
 <div class="action"><%= f.submit %></div>
 <% end %>

我的user.erb文件。      class User&lt;的ActiveRecord ::基

 has_secure_password

 attr_accessible :email, :password, :password_confirmation

 validates_uniqueness_of :email
end

错误完全跟踪。

activerecord (4.1.8) lib/active_record/connection_adapters/sqlite3_adapter.rb:515:in `table_structure'
activerecord (4.1.8) lib/active_record/connection_adapters/sqlite3_adapter.rb:390:in `columns'
activerecord (4.1.8) lib/active_record/connection_adapters/schema_cache.rb:93:in `block in prepare_default_proc'
activerecord (4.1.8) lib/active_record/connection_adapters/schema_cache.rb:44:in `yield'
activerecord (4.1.8) lib/active_record/connection_adapters/schema_cache.rb:44:in `columns'
activerecord (4.1.8) lib/active_record/model_schema.rb:214:in `columns'
activerecord (4.1.8) lib/active_record/model_schema.rb:255:in `column_defaults'
activerecord (4.1.8) lib/active_record/locking/optimistic.rb:174:in `column_defaults'
activerecord (4.1.8) lib/active_record/core.rb:184:in `initialize'
activerecord (4.1.8) lib/active_record/inheritance.rb:30:in `new'
activerecord (4.1.8) lib/active_record/inheritance.rb:30:in `new'
app/controllers/users_controller.rb:4:in `new'
actionpack (4.1.8) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.1.8) lib/abstract_controller/base.rb:189:in `process_action'
actionpack (4.1.8) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.1.8) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.1.8) lib/active_support/callbacks.rb:113:in `call'
activesupport (4.1.8) lib/active_support/callbacks.rb:113:in `call'
activesupport (4.1.8) lib/active_support/callbacks.rb:229:in `block in halting'
activesupport (4.1.8) lib/active_support/callbacks.rb:229:in `call'
activesupport (4.1.8) lib/active_support/callbacks.rb:229:in `block in halting'
activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `call'
activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `block in halting'
activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `call'
activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `block in halting'
activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `call'
activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `block in halting'
activesupport (4.1.8) lib/active_support/callbacks.rb:86:in `call'
activesupport (4.1.8) lib/active_support/callbacks.rb:86:in `run_callbacks'
actionpack (4.1.8) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.1.8) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.1.8) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.1.8) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.1.8) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.1.8) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.1.8) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.1.8) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.1.8) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.1.8) lib/abstract_controller/base.rb:136:in `process'
actionview (4.1.8) lib/action_view/rendering.rb:30:in `process'
actionpack (4.1.8) lib/action_controller/metal.rb:196:in `dispatch'
actionpack (4.1.8) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.1.8) lib/action_controller/metal.rb:232:in `block in action'
actionpack (4.1.8) lib/action_dispatch/routing/route_set.rb:82:in `call'
actionpack (4.1.8) lib/action_dispatch/routing/route_set.rb:82:in `dispatch'
actionpack (4.1.8) lib/action_dispatch/routing/route_set.rb:50:in `call'
actionpack (4.1.8) lib/action_dispatch/journey/router.rb:73:in `block in call'
actionpack (4.1.8) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.1.8) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.1.8) lib/action_dispatch/routing/route_set.rb:678:in `call'
rack (1.5.5) lib/rack/etag.rb:23:in `call'
rack (1.5.5) lib/rack/conditionalget.rb:25:in `call'
rack (1.5.5) lib/rack/head.rb:11:in `call'
actionpack (4.1.8) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.1.8) lib/action_dispatch/middleware/flash.rb:254:in `call'
rack (1.5.5) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.5) lib/rack/session/abstract/id.rb:220:in `call'

0 个答案:

没有答案