fix the paths problem
This commit is contained in:
parent
6f5c91cd4a
commit
6dffa73f09
@ -15,7 +15,7 @@ class AccountsController < ApplicationController
|
|||||||
|
|
||||||
def edit
|
def edit
|
||||||
if @user.is_admin?
|
if @user.is_admin?
|
||||||
redirect_to users_path, notice: 'Admins are not editable by other admins.'
|
redirect_to accounts_path, notice: 'Admins are not editable by other admins.'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ class AccountsController < ApplicationController
|
|||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @user.save
|
if @user.save
|
||||||
format.html { redirect_to @user, notice: 'User was successfully created.' }
|
format.html { redirect_to account_path(@user), notice: 'User was successfully created.' }
|
||||||
format.json { render action: 'show', status: :created, location: @user }
|
format.json { render action: 'show', status: :created, location: @user }
|
||||||
else
|
else
|
||||||
format.html { render action: 'new' }
|
format.html { render action: 'new' }
|
||||||
@ -38,7 +38,7 @@ class AccountsController < ApplicationController
|
|||||||
params[:user].delete(:current_password)
|
params[:user].delete(:current_password)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @user.update(user_params)
|
if @user.update(user_params)
|
||||||
format.html { redirect_to @user, notice: 'User was successfully updated.' }
|
format.html { redirect_to account_path(@user), notice: 'User was successfully updated.' }
|
||||||
format.json { head :no_content }
|
format.json { head :no_content }
|
||||||
else
|
else
|
||||||
format.html { render action: 'edit', notice: @user.errors }
|
format.html { render action: 'edit', notice: @user.errors }
|
||||||
@ -52,7 +52,7 @@ class AccountsController < ApplicationController
|
|||||||
def destroy
|
def destroy
|
||||||
@user.destroy
|
@user.destroy
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to users_url }
|
format.html { redirect_to accounts_url }
|
||||||
format.json { head :no_content }
|
format.json { head :no_content }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<h2>Edit <%= @user.email %></h2>
|
<h2>Edit <%= @user.email %></h2>
|
||||||
|
|
||||||
<%= simple_form_for(@user, url: user_path(@user), html: { method: :put }) do |f| %>
|
<%= simple_form_for(@user, url: account_path(@user), html: { method: :put }) do |f| %>
|
||||||
<%= f.error_notification %>
|
<%= f.error_notification %>
|
||||||
|
|
||||||
<div class="form-inputs">
|
<div class="form-inputs">
|
||||||
|
@ -14,11 +14,11 @@
|
|||||||
<% next if user.is_admin? %>
|
<% next if user.is_admin? %>
|
||||||
<% next if user.equal?(current_user) %>
|
<% next if user.equal?(current_user) %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= link_to user.email, user %></td>
|
<td><%= link_to user.email, account_path(user) %></td>
|
||||||
<td><%= link_to 'Edit', edit_user_path(user) %></td>
|
<td><%= link_to 'Edit', edit_account_path(user) %></td>
|
||||||
<td><%= link_to 'Destroy', user_path(user), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
<td><%= link_to 'Destroy', account_path(user), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<%= link_to 'New user', new_user_path unless Rails.env.production? %>
|
<%= link_to 'New user', new_account_path unless Rails.env.production? %>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<h1>New User</h1>
|
<h1>New User</h1>
|
||||||
<%= simple_form_for(@user, url: users_path) do |f| %>
|
<%= simple_form_for(@user, url: accounts_path) do |f| %>
|
||||||
<%= f.error_notification %>
|
<%= f.error_notification %>
|
||||||
|
|
||||||
<div class="form-inputs">
|
<div class="form-inputs">
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<div class="navbar-collapse collapse">
|
<div class="navbar-collapse collapse">
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
<% if admin_signed_in? %>
|
<% if admin_signed_in? %>
|
||||||
<li><%= link_to "Edit Users", users_path %></li>
|
<li><%= link_to "Edit Users", accounts_path %></li>
|
||||||
<% else %>
|
<% else %>
|
||||||
<% if user_signed_in? %>
|
<% if user_signed_in? %>
|
||||||
<li><%= link_to "Login as Admin", new_admin_session_path %></li>
|
<li><%= link_to "Login as Admin", new_admin_session_path %></li>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Vidpush::Application.routes.draw do
|
Vidpush::Application.routes.draw do
|
||||||
resources :users, :controller => "accounts", path: "accounts"
|
resources :accounts, :controller => "accounts", path: "accounts", model: :users
|
||||||
|
|
||||||
devise_for :admins
|
devise_for :admins
|
||||||
devise_for :users
|
devise_for :users
|
||||||
|
@ -97,8 +97,8 @@ ActiveRecord::Schema.define(version: 20140505153412) do
|
|||||||
t.string "authentication_token"
|
t.string "authentication_token"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "accounts", ["email"], name: "index_users_on_email", unique: true, using: :btree
|
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
|
||||||
add_index "accounts", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
|
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
|
||||||
|
|
||||||
create_table "videolistings", force: true do |t|
|
create_table "videolistings", force: true do |t|
|
||||||
t.string "videocode"
|
t.string "videocode"
|
||||||
|
Loading…
Reference in New Issue
Block a user