最近我对我的应用做了一些修改 我使用两个具有1个用户数据库的函数,我不知道是否在路由或迁移时出错。
我的问题是我无法更新用户的属性,当我尝试更新时,我会重定向到主页,当我尝试登录时说我的帐户不存在。
这是我的架构
ActiveRecord::Schema.define(version: 20150510044605) do
create_table "comments", force: :cascade do |t|
t.integer "link_id"
t.text "body"
t.integer "user_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "comments", ["link_id"], name: "index_comments_on_link_id"
add_index "comments", ["user_id"], name: "index_comments_on_user_id"
create_table "links", force: :cascade do |t|
t.string "title"
t.string "url"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "user_id"
t.string "image_file_name"
t.string "image_content_type"
t.integer "image_file_size"
t.datetime "image_updated_at"
end
add_index "links", ["user_id"], name: "index_links_on_user_id"
create_table "pins", force: :cascade do |t|
t.string "title"
t.text "description"
t.integer "price"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "image_file_name"
t.string "image_content_type"
t.integer "image_file_size"
t.datetime "image_updated_at"
t.integer "user_id"
end
add_index "pins", ["user_id"], name: "index_pins_on_user_id"
create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.string "name"
end
add_index "users", ["email"], name: "index_users_on_email", unique: true
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
create_table "votes", force: :cascade do |t|
t.integer "votable_id"
t.string "votable_type"
t.integer "voter_id"
t.string "voter_type"
t.boolean "vote_flag"
t.string "vote_scope"
t.integer "vote_weight"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "votes", ["votable_id", "votable_type", "vote_scope"], name: "index_votes_on_votable_id_and_votable_type_and_vote_scope"
add_index "votes", ["voter_id", "voter_type", "vote_scope"], name: "index_votes_on_voter_id_and_voter_type_and_vote_scope"
end
App Controller
lass ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_filter :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up) { |params|
params.permit(
:email, :password, :password_confirmation, :name,
:last_name, :profile_name
)
}
devise_parameter_sanitizer.for(:account_update) { |params|
params.permit(
:email, :password, :password_confirmation, :name,
:last_name, :profile_name
)
}
end
end
路线
Rails.application.routes.draw do
resources :comments
resources :pins
devise_for :users
resources :links do
member do
put "like", to: "links#upvote"
put "dislike", to: "links#downvote"
end
resources :comments
end
resources :pins do
member do
put "like", to: "pins#upvote"
end
end
authenticated :user do
root 'links#index', as: "authenticated_root"
end
root 'pages#home'
end
我是铁杆新手,所以我不知道如何找到或找到什么。