Bu hatayı alıyorum: undefined yerel değişken ya da "user" için profil denetleyicisi satır 9'a işaret eden "user", "def güncelleme yönteminden sonra ilk satır" BTW Devise için kullanıyorum Kullanıcım editörüm "rubymine" söylüyor İşte burada undefined yerel değişken veya "kullanıcı" yöntemi
class ProfileController < ApplicationController
before_action :authenticate_user!
def index
@user = current_user
end
def update
current_user.update(user.params)
redirect_to root_path
end
private
def user_params
params.require(user).permit(:first_name, :last_name)
end
end
user_signed_in ?, örnein, destroy_user_session_path, new_user_session_path ve new_user_registration_path
<!DOCTYPE html>
<html>
<head>
<title>TwitterClone</title>
<%= stylesheet_link_tag 'application', media: 'all' %>
<%= javascript_include_tag 'application' %>
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.6/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.6/js/materialize.min.js"></script>
<%= csrf_meta_tags %>
</head>
<body>
<div class="right">
<% if user_signed_in? %>
Welcome <%= current_user.display_name %>,
<%= link_to "Logout", destroy_user_session_path, method: "DELETE" %>
<% else %>
Please
<%= link_to "Login", new_user_session_path %>
or
<%= link_to "Signup", new_user_registration_path %>
<% end %>
</div>
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
<%= yield %>
</body>
</html>
Benim yolları olanlardır BULUNAMADI bu benim application.html.erb olduğunu devise Kullanıcı için üretir artı Profil için var olanlar hangi: İşte
profile GET /profile(.:format) profile#index
PATCH /profile(.:format) profile#update
devise oluşturulan şema geçerli:
ActiveRecord::Schema.define(version: 20160406005549) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
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.inet "current_sign_in_ip"
t.inet "last_sign_in_ip"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "first_name"
t.string "last_name"
end
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
end
'user.params' user_params' – dp7