fix the paths problem

This commit is contained in:
Tyrel Souza 2014-05-14 14:11:52 -04:00
parent 6f5c91cd4a
commit 6dffa73f09
7 changed files with 14 additions and 14 deletions

View File

@ -15,7 +15,7 @@ class AccountsController < ApplicationController
def edit
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
@ -24,7 +24,7 @@ class AccountsController < ApplicationController
respond_to do |format|
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 }
else
format.html { render action: 'new' }
@ -38,7 +38,7 @@ class AccountsController < ApplicationController
params[:user].delete(:current_password)
respond_to do |format|
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 }
else
format.html { render action: 'edit', notice: @user.errors }
@ -52,7 +52,7 @@ class AccountsController < ApplicationController
def destroy
@user.destroy
respond_to do |format|
format.html { redirect_to users_url }
format.html { redirect_to accounts_url }
format.json { head :no_content }
end
end

View File

@ -1,6 +1,6 @@
<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 %>
<div class="form-inputs">

View File

@ -14,11 +14,11 @@
<% next if user.is_admin? %>
<% next if user.equal?(current_user) %>
<tr>
<td><%= link_to user.email, user %></td>
<td><%= link_to 'Edit', edit_user_path(user) %></td>
<td><%= link_to 'Destroy', user_path(user), method: :delete, data: { confirm: 'Are you sure?' } %></td>
<td><%= link_to user.email, account_path(user) %></td>
<td><%= link_to 'Edit', edit_account_path(user) %></td>
<td><%= link_to 'Destroy', account_path(user), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<%= link_to 'New user', new_user_path unless Rails.env.production? %>
<%= link_to 'New user', new_account_path unless Rails.env.production? %>

View File

@ -1,5 +1,5 @@
<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 %>
<div class="form-inputs">

View File

@ -12,7 +12,7 @@
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<% if admin_signed_in? %>
<li><%= link_to "Edit Users", users_path %></li>
<li><%= link_to "Edit Users", accounts_path %></li>
<% else %>
<% if user_signed_in? %>
<li><%= link_to "Login as Admin", new_admin_session_path %></li>

View File

@ -1,5 +1,5 @@
Vidpush::Application.routes.draw do
resources :users, :controller => "accounts", path: "accounts"
resources :accounts, :controller => "accounts", path: "accounts", model: :users
devise_for :admins
devise_for :users

View File

@ -97,8 +97,8 @@ ActiveRecord::Schema.define(version: 20140505153412) do
t.string "authentication_token"
end
add_index "accounts", ["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", ["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
create_table "videolistings", force: true do |t|
t.string "videocode"