ruby on rails - Could not find table 'users'? -
i tried possible. adding files kindly have look.
i have run:
rake db:drop
(to drop tables)rake db:create
(to create databse)rake db:migrate
(to create tables)rake db:test:prepare
(to create test database)
controller file:
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 siging up!" else render "new" end end end
my html.erb file.
<h1>login</h1> <% form_for @user |f|%> <% if @user.errors.any? %> <div class="error_message"> <h2>form invalid</h2> <ul> <% @user.error.full_message.each |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 %>
my user.erb file. class user < activerecord::base
has_secure_password attr_accessible :email, :password, :password_confirmation validates_uniqueness_of :email end
the errors full trace.
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'
Comments
Post a Comment