From 7cadcabdceb04a2449e03a259f491c4fce365c9c Mon Sep 17 00:00:00 2001 From: Will Bradley Date: Fri, 25 Jan 2013 07:11:22 -0700 Subject: [PATCH] Updated routes and user form to avoid user-create conflicts with devise --- app/views/users/_form.html.erb | 7 ++++++- config/routes.rb | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb index a2e85f9..e580602 100644 --- a/app/views/users/_form.html.erb +++ b/app/views/users/_form.html.erb @@ -1,4 +1,9 @@ -<%= form_for(@user) do |f| %> +<% if @user.id.blank? then + this_url = users_create_path + else + this_url = user_path(@user) + end %> +<%= form_for @user, :url => this_url do |f| %> <% if @user.errors.any? %>

<%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:

diff --git a/config/routes.rb b/config/routes.rb index c71804e..55cb2ac 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,6 +6,7 @@ Dooraccess::Application.routes.draw do devise_for :users resources :users + match 'users/create' => 'users#create', :via => :post # Use POST users/create instead of POST users to avoid devise conflict match 'cards/upload_all' => 'cards#upload_all', :as => :upload_all resources :cards