私は、ユーザーの電子メールとそのIPを収集するキャンペーンを作成するためのレールアプリケーションを用意しています。これが発生すると、情報はユーザーの作成に使用されます。deviseを持つユーザーとは異なるモデルを使用する方法
ただし、このキャンペーンを作成して管理するためのアカウントを作成して登録できる別のユーザーが必要です。私は1つだけのユーザーモデルを使用することに慣れているので、2つの方法を区別する方法が正確にはわかりません。
路線:以下
は、その現在の設定方法ですName::Application.routes.draw do
ActiveAdmin.routes(self)
devise_for :admin_users, ActiveAdmin::Devise.config
root :to => "users#new"
post 'users/create' => 'users#create'
get 'refer-a-friend' => 'users#refer'
get 'privacy-policy' => 'users#policy'
unless Rails.application.config.consider_all_requests_local
get '*not_found', to: 'users#redirect', :format => false
end
end
スキーマ:
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20130312045541) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "active_admin_comments", force: :cascade do |t|
t.string "resource_id", null: false
t.string "resource_type", null: false
t.integer "author_id"
t.string "author_type"
t.text "body"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "namespace"
end
add_index "active_admin_comments", ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id", using: :btree
add_index "active_admin_comments", ["namespace"], name: "index_active_admin_comments_on_namespace", using: :btree
add_index "active_admin_comments", ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id", using: :btree
create_table "admin_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
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", null: false
t.datetime "updated_at", null: false
end
add_index "admin_users", ["email"], name: "index_admin_users_on_email", unique: true, using: :btree
add_index "admin_users", ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true, using: :btree
create_table "delayed_jobs", force: :cascade do |t|
t.integer "priority", default: 0
t.integer "attempts", default: 0
t.text "handler"
t.text "last_error"
t.datetime "run_at"
t.datetime "locked_at"
t.datetime "failed_at"
t.string "locked_by"
t.string "queue"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree
create_table "ip_addresses", force: :cascade do |t|
t.string "address"
t.integer "count"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "users", force: :cascade do |t|
t.string "email"
t.string "referral_code"
t.integer "referrer_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
end
は、より多くの情報が必要な場合、私に教えてください、私は喜んでそれを更新します。
これは私がやりたい/やりたいことでした。そうでない場合は更新されます。正確なマーキング。 – Kevin