From: yasushiito Date: Sat, 10 Mar 2012 00:28:12 +0000 (+0900) Subject: user check X-Git-Url: http://git.osdn.net/view?p=pettanr%2Fpettanr.git;a=commitdiff_plain;h=abd31c35793dae7d49fb08bc4313d571e2718806 user check --- diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2741dd3e..2be23256 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -9,11 +9,13 @@ class ApplicationController < ActionController::Base redirect_to :controller => '/system', :action => 'start' end else - if author_signed_in? - @artist = if current_author.artist? - current_author.artist + if user_signed_in? + @user = current_user + @author = @user.author + @artist = if @author and @author.artist? + @author.artist else - Artist.new author_id: current_author.id, email: current_author.email, name: current_author.name + Artist.new author_id: @author.id, email: @user.email, name: @author.name, default_license_id: 1 end end end diff --git a/app/controllers/artists_controller.rb b/app/controllers/artists_controller.rb index a2fa524d..bfedf197 100644 --- a/app/controllers/artists_controller.rb +++ b/app/controllers/artists_controller.rb @@ -1,5 +1,5 @@ class ArtistsController < ApplicationController - before_filter :authenticate_author!, :only => [:index, :show, :create, :update, :destroy] + before_filter :authenticate_user!, :only => [:index, :show, :create, :update, :destroy] before_filter :authenticate_admin!, :only => [:list, :browse] # GET /artists diff --git a/app/controllers/authors_controller.rb b/app/controllers/authors_controller.rb index a69fffad..6371ffdc 100644 --- a/app/controllers/authors_controller.rb +++ b/app/controllers/authors_controller.rb @@ -1,5 +1,5 @@ class AuthorsController < ApplicationController - before_filter :authenticate_author!, :only => [:index, :show] + before_filter :authenticate_user!, :only => [:index, :show] before_filter :authenticate_admin!, :only => [:list, :browse] def index diff --git a/app/controllers/balloon_templates_controller.rb b/app/controllers/balloon_templates_controller.rb index faa1ca00..e224e2fb 100644 --- a/app/controllers/balloon_templates_controller.rb +++ b/app/controllers/balloon_templates_controller.rb @@ -1,5 +1,5 @@ class BalloonTemplatesController < ApplicationController - before_filter :authenticate_author!, :only => [:index, :show] + before_filter :authenticate_user!, :only => [:index, :show] before_filter :authenticate_admin!, :only => [:list, :browse] # GET /balloon_templates diff --git a/app/controllers/balloons_controller.rb b/app/controllers/balloons_controller.rb index 69a92322..eb8025ce 100644 --- a/app/controllers/balloons_controller.rb +++ b/app/controllers/balloons_controller.rb @@ -1,5 +1,5 @@ class BalloonsController < ApplicationController - before_filter :authenticate_author!, :only => [:index, :show] + before_filter :authenticate_user!, :only => [:index, :show] before_filter :authenticate_admin!, :only => [:list, :browse] # GET /balloons diff --git a/app/controllers/comics_controller.rb b/app/controllers/comics_controller.rb index c556b090..fdddd7ae 100644 --- a/app/controllers/comics_controller.rb +++ b/app/controllers/comics_controller.rb @@ -1,11 +1,11 @@ class ComicsController < ApplicationController - before_filter :authenticate_author!, :only => [:top, :index, :show, :play, :create, :update, :destroy] + before_filter :authenticate_user!, :only => [:top, :index, :show, :play, :create, :update, :destroy] before_filter :authenticate_admin!, :only => [:list, :browse] private def treat_param comic - comic.author_id = current_author.id + comic.author_id = @author.id end public @@ -130,7 +130,7 @@ class ComicsController < ApplicationController # PUT /comics/1.json def update @comic = Comic.find(params[:id]) - if @comic.own? current_author + if @comic.own? @author respond_to do |format| if @comic.update_attributes(params[:comic]) format.html { redirect_to @comic, notice: 'Comic was successfully updated.' } @@ -150,7 +150,7 @@ class ComicsController < ApplicationController # DELETE /comics/1.json def destroy @comic = Comic.find(params[:id]) - if @comic.own? current_author + if @comic.own? @author @comic.destroy respond_to do |format| format.html { redirect_to comics_url } diff --git a/app/controllers/common_licenses_controller.rb b/app/controllers/common_licenses_controller.rb index 8be20392..cefb6d66 100644 --- a/app/controllers/common_licenses_controller.rb +++ b/app/controllers/common_licenses_controller.rb @@ -1,5 +1,5 @@ class CommonLicensesController < ApplicationController - before_filter :authenticate_author!, :only => [:index, :show] + before_filter :authenticate_user!, :only => [:index, :show] before_filter :authenticate_admin!, :only => [:list, :browse, :new, :edit, :create, :update, :destroy] # GET /common_licenses diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 0b64ee9e..e022d0d0 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,5 +1,5 @@ class HomeController < ApplicationController - before_filter :authenticate_author!, :only => [ + before_filter :authenticate_user!, :only => [ :index, :show, :profile, :configure, :create_token, :delete_token, :step2, :save_step2, :step3, :save_step3, :comic, :picture ] @@ -14,10 +14,9 @@ class HomeController < ApplicationController end def create_token - @author = current_author respond_to do |format| - if @author.create_token - format.html { redirect_to({:action => :configure}, {:notice => 'author token was successfully created.'}) } + if @user.create_token + format.html { redirect_to({:action => :configure}, {:notice => 'user token was successfully created.'}) } else format.html { render action: "auth_token" } end @@ -25,18 +24,16 @@ class HomeController < ApplicationController end def delete_token - current_author.delete_token + @user.delete_token respond_to do |format| format.html { redirect_to :action => :configure} end end def step2 - @author = current_author end def save_step2 - @author = current_author respond_to do |format| if @author.step2(params[:author][:name]) a = if params[:step3].to_i == 1 @@ -52,11 +49,10 @@ class HomeController < ApplicationController end def step3 - @artist = Artist.new :author_id => current_author.id, :name => current_author.name, :default_license_id => 1 end def save_step3 - if current_author.artist? + if @author.artist? redirect_to :action => :index else @artist = Artist.new params[:artist] @@ -72,7 +68,7 @@ class HomeController < ApplicationController def comic @comics = Comic.find(:all, - :include => :author, :conditions => ['author_id = ?', current_author.id], + :include => :author, :conditions => ['author_id = ?', @author.id], :order => 'updated_at desc', :limit => 20 ) @@ -83,9 +79,9 @@ class HomeController < ApplicationController end def picture - if current_author.artist? + if @author.artist? @original_pictures = OriginalPicture.find(:all, - :include => [:artist, :license, :resource_picture], :conditions => ['artist_id = ?', current_author.artist.id], + :include => [:artist, :license, :resource_picture], :conditions => ['artist_id = ?', @author.artist.id], :order => 'updated_at', :limit => 20 ) diff --git a/app/controllers/licenses_controller.rb b/app/controllers/licenses_controller.rb index e5e88c82..b92b0b99 100644 --- a/app/controllers/licenses_controller.rb +++ b/app/controllers/licenses_controller.rb @@ -1,5 +1,5 @@ class LicensesController < ApplicationController - before_filter :authenticate_author!, :only => [:index, :show] + before_filter :authenticate_user!, :only => [:index, :show] before_filter :authenticate_admin!, :only => [:list, :browse] # GET /licenses diff --git a/app/controllers/original_licenses_controller.rb b/app/controllers/original_licenses_controller.rb index 99878945..a88d3ea2 100644 --- a/app/controllers/original_licenses_controller.rb +++ b/app/controllers/original_licenses_controller.rb @@ -1,5 +1,5 @@ class OriginalLicensesController < ApplicationController - before_filter :authenticate_author!, :only => [:index, :show, :new, :edit, :create, :update, :destroy] + before_filter :authenticate_user!, :only => [:index, :show, :new, :edit, :create, :update, :destroy] before_filter :authenticate_admin!, :only => [:list, :browse] # GET /original_licenses @@ -62,7 +62,7 @@ class OriginalLicensesController < ApplicationController # POST /original_licenses.json def create @original_license = OriginalLicense.new(params[:original_license]) - @original_license.artist_id = current_author.artist.id + @original_license.artist_id = @author.artist.id respond_to do |format| if @original_license.save_save format.html { redirect_to @original_license, notice: 'Original license was successfully created.' } diff --git a/app/controllers/original_pictures_controller.rb b/app/controllers/original_pictures_controller.rb index 85c77df0..694f57d7 100644 --- a/app/controllers/original_pictures_controller.rb +++ b/app/controllers/original_pictures_controller.rb @@ -1,5 +1,5 @@ class OriginalPicturesController < ApplicationController - before_filter :authenticate_author!, :only => [:index, :show, :new, :edit, :create, :update, :destroy] + before_filter :authenticate_user!, :only => [:index, :show, :new, :edit, :create, :update, :destroy] before_filter :authenticate_admin!, :only => [:list, :browse] private @@ -122,8 +122,8 @@ class OriginalPicturesController < ApplicationController end @original_picture = OriginalPicture.new img = set_image params - @original_picture.artist_id = current_author.artist.id - @original_picture.license_id = current_author.artist.default_license_id + @original_picture.artist_id = @author.artist.id + @original_picture.license_id = @author.artist.default_license_id respond_to do |format| OriginalPicture.transaction do @@ -154,7 +154,7 @@ class OriginalPicturesController < ApplicationController return end @original_picture = OriginalPicture.find(params[:id]) - unless @original_picture.own? current_author + unless @original_picture.own? @author respond_to do |format| format.html { redirect_to @original_picture, notice: 'Failed! ' } format.json { render json: @original_picture.errors, status: :unprocessable_entity } @@ -192,7 +192,7 @@ class OriginalPicturesController < ApplicationController return end @original_picture = OriginalPicture.find(params[:id]) - unless @original_picture.own? current_author + unless @original_picture.own? @author respond_to do |format| format.html { redirect_to @original_picture, notice: 'Failed! ' } format.json { render json: @original_picture.errors, status: :unprocessable_entity } diff --git a/app/controllers/panel_pictures_controller.rb b/app/controllers/panel_pictures_controller.rb index 37594b7e..95ea5ff3 100644 --- a/app/controllers/panel_pictures_controller.rb +++ b/app/controllers/panel_pictures_controller.rb @@ -1,5 +1,5 @@ class PanelPicturesController < ApplicationController - before_filter :authenticate_author!, :only => [:index, :show] + before_filter :authenticate_user!, :only => [:index, :show] before_filter :authenticate_admin!, :only => [:list, :browse] # GET /panel_pictures diff --git a/app/controllers/panels_controller.rb b/app/controllers/panels_controller.rb index 82475e99..175721d5 100644 --- a/app/controllers/panels_controller.rb +++ b/app/controllers/panels_controller.rb @@ -1,11 +1,11 @@ class PanelsController < ApplicationController - before_filter :authenticate_author!, :only => [:index, :show, :create, :update, :destroy] + before_filter :authenticate_user!, :only => [:index, :show, :create, :update, :destroy] before_filter :authenticate_admin!, :only => [:list, :browse] private def treat_param panel - panel.author_id = current_author.id + panel.author_id = @author.id end public @@ -87,7 +87,7 @@ class PanelsController < ApplicationController # PUT /panels/1.json def update @panel = Panel.find(params[:id]) - if @panel.own? current_author + if @panel.own? @author respond_to do |format| Panel.transaction do if params[:panel][:t] and params[:panel][:t].to_i != @panel.t @@ -112,7 +112,7 @@ class PanelsController < ApplicationController # DELETE /panels/1.json def destroy @panel = Panel.find(params[:id]) - if @panel.own? current_author + if @panel.own? @author respond_to do |format| Panel.transaction do @panel.destroy_and_shorten diff --git a/app/controllers/resource_pictures_controller.rb b/app/controllers/resource_pictures_controller.rb index dd6879e6..4b177727 100644 --- a/app/controllers/resource_pictures_controller.rb +++ b/app/controllers/resource_pictures_controller.rb @@ -1,5 +1,5 @@ class ResourcePicturesController < ApplicationController - before_filter :authenticate_author!, :only => [:index, :show] + before_filter :authenticate_user!, :only => [:index, :show] before_filter :authenticate_admin!, :only => [:list, :browse] # GET /resource_pictures diff --git a/app/controllers/speach_balloons_controller.rb b/app/controllers/speach_balloons_controller.rb index 1072cc93..c198b99c 100644 --- a/app/controllers/speach_balloons_controller.rb +++ b/app/controllers/speach_balloons_controller.rb @@ -1,5 +1,5 @@ class SpeachBalloonsController < ApplicationController - before_filter :authenticate_author!, :only => [:index, :show] + before_filter :authenticate_user!, :only => [:index, :show] before_filter :authenticate_admin!, :only => [:list, :browse, :create, :update, :destroy] private diff --git a/app/controllers/speach_templates_controller.rb b/app/controllers/speach_templates_controller.rb index ddc3011b..df60b690 100644 --- a/app/controllers/speach_templates_controller.rb +++ b/app/controllers/speach_templates_controller.rb @@ -1,5 +1,5 @@ class SpeachTemplatesController < ApplicationController - before_filter :authenticate_author!, :only => [:index, :show] + before_filter :authenticate_user!, :only => [:index, :show] before_filter :authenticate_admin!, :only => [:list, :browse] # GET /speach_templates diff --git a/app/controllers/speaches_controller.rb b/app/controllers/speaches_controller.rb index 1619319c..35a55950 100644 --- a/app/controllers/speaches_controller.rb +++ b/app/controllers/speaches_controller.rb @@ -1,5 +1,5 @@ class SpeachesController < ApplicationController - before_filter :authenticate_author!, :only => [:index, :show] + before_filter :authenticate_user!, :only => [:index, :show] before_filter :authenticate_admin!, :only => [:list, :browse] # GET /speaches diff --git a/app/controllers/system_pictures_controller.rb b/app/controllers/system_pictures_controller.rb index 8843d8d0..884d33cb 100644 --- a/app/controllers/system_pictures_controller.rb +++ b/app/controllers/system_pictures_controller.rb @@ -1,5 +1,5 @@ class SystemPicturesController < ApplicationController - before_filter :authenticate_author!, :only => [:index, :show] + before_filter :authenticate_user!, :only => [:index, :show] before_filter :authenticate_admin!, :only => [:list, :browse, :create, :update, :destroy] private diff --git a/app/models/user.rb b/app/models/user.rb index 90958af6..ff5f34ed 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -9,6 +9,10 @@ class User < ActiveRecord::Base # Setup accessible (or protected) attributes for your model attr_accessible :id, :name, :password, :password_confirmation, :remember_me , :email + before_create do |r| + r.build_author :name => 'no name' + end + def create_token self.ensure_authentication_token self.save diff --git a/app/views/comics/play.html.erb b/app/views/comics/play.html.erb index 8084e33c..ef304213 100644 --- a/app/views/comics/play.html.erb +++ b/app/views/comics/play.html.erb @@ -1,23 +1,21 @@

<%= h @comic.title %>

-<% if author_signed_in? -%> - <% if @comic.own? current_author -%> -
-

<%= notice %>

-

- Title: - <%= h @comic.title %> -

-

- visible: - <%= @comic.visible %> -

-

- editable: - <%= @comic.editable %> -

- <%= link_to 'Destroy', @comic, confirm: 'Are you sure?', method: :delete %> -
- <% end -%> +<% if @comic.own? @author -%> +
+

<%= notice %>

+

+ Title: + <%= h @comic.title %> +

+

+ visible: + <%= @comic.visible %> +

+

+ editable: + <%= @comic.editable %> +

+ <%= link_to 'Destroy', @comic, confirm: 'Are you sure?', method: :delete %> +
<% end -%> <% @comic.panels.each do |panel| %> diff --git a/app/views/comics/top.html.erb b/app/views/comics/top.html.erb index 6b202543..1e260f03 100644 --- a/app/views/comics/top.html.erb +++ b/app/views/comics/top.html.erb @@ -17,8 +17,8 @@ <%= comic.author_id%> <%= comic.updated_at %> - <% if author_signed_in? -%> - <% if comic.own? current_author -%> + <% if user_signed_in? -%> + <% if comic.own? @author -%> <%= link_to 'Destroy', comic, confirm: 'Are you sure?', method: :delete %> <% end -%> <% end -%> diff --git a/app/views/home/configure.html.erb b/app/views/home/configure.html.erb index 38b80aff..02196cd0 100644 --- a/app/views/home/configure.html.erb +++ b/app/views/home/configure.html.erb @@ -1,9 +1,9 @@

認証トークン

-あなたの認証トークンは<%= current_author.authentication_token %>です +あなたの認証トークンは<%= @user.authentication_token %>です
- <% if current_author.authentication_token %> + <% if @user.authentication_token %> <%= link_to 'delete token', :action => :delete_token %> <% else %> <%= link_to 'generate token', :action => :create_token %> @@ -11,5 +11,5 @@

退会

- <%= link_to('退会する', {:controller => 'author_registrations', :action => :destroy, :id => current_author.id}, {:method => :delete}) %> + <%= link_to('退会する', {:controller => 'user_registrations', :action => :destroy, :id => @user.id}, {:method => :delete}) %>
diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index ea26dcb7..26ddf739 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,11 +1,12 @@ -

<%= h(current_author.name) -%>(<%= h(current_author.email) -%>)

+

<%= h(@author.name) -%>(<%= h(@user.email) -%>)

絵師活動

-<% if current_author.artist? -%> - <%= link_to h(current_author.artist.name), current_author.artist %>です +<% if @author.artist? -%> + <%= link_to h(@author.artist.name), @author.artist %>です <% else -%>

まだ絵師登録していません。

登録する

+ <%= render 'original_pictures/artist_register' %> <% end -%>
diff --git a/app/views/home/step2.html.erb b/app/views/home/step2.html.erb index 8b10327c..0b69bf4e 100644 --- a/app/views/home/step2.html.erb +++ b/app/views/home/step2.html.erb @@ -1,6 +1,6 @@

ようこそ、ぺったんRへ

-<%= h(current_author.email) -%>さんはぺったんRで作家としてデビューしました。 +<%= h(@user.email) -%>さんはぺったんRで作家としてデビューしました。 今すぐにでも作品を作れますが、より良い活動をするために作家名を登録してください。
<%= form_for(:author, :url => {:controller => '/home', :action => :save_step2}) do |f| %> diff --git a/app/views/home/step3.html.erb b/app/views/home/step3.html.erb index 73a0bd81..9c1941ca 100644 --- a/app/views/home/step3.html.erb +++ b/app/views/home/step3.html.erb @@ -1,5 +1,5 @@

ようこそ、ぺったんRへ

-<%= h(current_author.name) -%>さん +<%= h(@author.name) -%>さん
<%= form_for(:artist, :url => {:controller => '/home', :action => :save_step3}) do |f| %> <% if @artist.errors.any? %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index be0c608b..d7106a67 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -10,14 +10,14 @@ ぺったんR
-<% if author_signed_in? %> +<% if user_signed_in? %> <%= link_to "my home", :controller => '/home' %> <%= link_to "my comics", :controller => '/home', :action => :comic %> <%= link_to "my pictures", :controller => '/home', :action => :picture %> <%= link_to "config", :controller => '/home', :action => :configure %> - <%= link_to "ログアウト", destroy_author_session_path, :method => :delete %> + <%= link_to "ログアウト", destroy_user_session_path, :method => :delete %> <% else %> - <%= link_to "ログイン", new_author_session_path %> + <%= link_to "ログイン", new_user_session_path %> <% end %>
diff --git a/app/views/layouts/system.html.erb b/app/views/layouts/system.html.erb index 7aaa4b99..8c8712e2 100644 --- a/app/views/layouts/system.html.erb +++ b/app/views/layouts/system.html.erb @@ -10,11 +10,11 @@ ぺったんR
-<% if author_signed_in? %> +<% if user_signed_in? %> <%= link_to "my home", :controller => '/home' %> - <%= link_to "ログアウト", destroy_author_session_path, :method => :delete %> + <%= link_to "ログアウト", destroy_user_session_path, :method => :delete %> <% else %> - <%= link_to "ログイン", new_author_session_path %> + <%= link_to "ログイン", new_user_session_path %> <% end %>
diff --git a/app/views/original_pictures/_uploader.html.erb b/app/views/original_pictures/_uploader.html.erb index b09314a4..7b52a5ef 100644 --- a/app/views/original_pictures/_uploader.html.erb +++ b/app/views/original_pictures/_uploader.html.erb @@ -1,14 +1,14 @@ -<% if author_signed_in? -%> - <% if current_author.artist? -%> +<% if user_signed_in? -%> + <% if @author.artist? -%> <%= form_tag( {:action => "create"} , { :multipart => true }) do %> <%= file_field_tag "original_picture[file]" %> license - <%= collection_select :original_picture, :license_id, License.all.map {|l| [l.name, l.id] }, :last, :first, :html => {:selected => current_author.artist.default_license_id} %> + <%= collection_select :original_picture, :license_id, License.all.map {|l| [l.name, l.id] }, :last, :first, :html => {:selected => @author.artist.default_license_id} %> <%= submit_tag 'upload' -%> <% end -%> <% else -%> <%= render 'artist_register' %> <% end -%> <% else -%> - 素材を投稿するなら<%= link_to "ログイン", new_author_session_path %> + 素材を投稿するなら<%= link_to "ログイン", new_user_session_path %> <% end -%> diff --git a/app/views/original_pictures/browse.html.erb b/app/views/original_pictures/browse.html.erb index 4eb5bb07..fe317a2b 100644 --- a/app/views/original_pictures/browse.html.erb +++ b/app/views/original_pictures/browse.html.erb @@ -38,7 +38,7 @@

<%= link_to '再生成', :action => :refresh, :id => @original_picture.id %>

-<% if @original_picture.own? current_author -%> +<% if @original_picture.own? @author -%>

Replace picture

diff --git a/app/views/original_pictures/show.html.erb b/app/views/original_pictures/show.html.erb index a48ef440..858d167c 100644 --- a/app/views/original_pictures/show.html.erb +++ b/app/views/original_pictures/show.html.erb @@ -33,7 +33,7 @@

<%= link_to '再生成', :action => :refresh, :id => @original_picture.id %>

-<% if @original_picture.own? current_author -%> +<% if @original_picture.own? @author -%>

Replace picture

diff --git a/app/views/author_registrations/new.html.erb b/app/views/user_registrations/new.html.erb similarity index 100% rename from app/views/author_registrations/new.html.erb rename to app/views/user_registrations/new.html.erb diff --git a/config/routes.rb b/config/routes.rb index a06d818a..5ba523c9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,6 @@ Pettanr::Application.routes.draw do - devise_for :users, :controllers => { :registrations => "user_registrations" } + devise_for :users , :controllers => { :registrations => "user_registrations" } devise_for :admins match 'original_pictures/:id(.:format)/refresh' => 'original_pictures#refresh' diff --git a/db/migrate/20111206091950_create_authors.rb b/db/migrate/20111206091950_create_authors.rb index c2dc72ff..d7db5411 100644 --- a/db/migrate/20111206091950_create_authors.rb +++ b/db/migrate/20111206091950_create_authors.rb @@ -7,11 +7,7 @@ class CreateAuthors < ActiveRecord::Migration t.timestamps end - add_index :authors, :email, :unique => true - add_index :authors, :reset_password_token, :unique => true - add_index :authors, :confirmation_token, :unique => true - # add_index :authors, :unlock_token, :unique => true - add_index :authors, :authentication_token, :unique => true + add_index :authors, :user_id, :unique => true end end diff --git a/db/migrate/20120306231650_devise_create_users.rb b/db/migrate/20120306231650_devise_create_users.rb index 6372e999..915a976a 100644 --- a/db/migrate/20120306231650_devise_create_users.rb +++ b/db/migrate/20120306231650_devise_create_users.rb @@ -15,11 +15,11 @@ class DeviseCreateUsers < ActiveRecord::Migration t.timestamps end - add_index :authors, :email, :unique => true - add_index :authors, :reset_password_token, :unique => true - add_index :authors, :confirmation_token, :unique => true - # add_index :authors, :unlock_token, :unique => true - add_index :authors, :authentication_token, :unique => true + add_index :users, :email, :unique => true + add_index :users, :reset_password_token, :unique => true + add_index :users, :confirmation_token, :unique => true + # add_index :users, :unlock_token, :unique => true + add_index :users, :authentication_token, :unique => true end end diff --git a/db/schema.rb b/db/schema.rb index 454f5d34..6160bd67 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120102071851) do +ActiveRecord::Schema.define(:version => 20120306231650) do create_table "admins", :force => true do |t| t.string "email", :default => "", :null => false @@ -43,7 +43,7 @@ ActiveRecord::Schema.define(:version => 20120102071851) do t.string "name" t.string "homepage_url" t.string "api_url" - t.integer "default_license_id" + t.integer "default_license_id", :default => 0, :null => false t.datetime "crowled_at" t.datetime "created_at" t.datetime "updated_at" @@ -52,28 +52,12 @@ ActiveRecord::Schema.define(:version => 20120102071851) do create_table "authors", :force => true do |t| t.string "name" - t.string "email", :default => "", :null => false - t.string "encrypted_password", :limit => 128, :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.string "authentication_token" - t.string "confirmation_token" - t.datetime "confirmed_at" - t.datetime "confirmation_sent_at" + t.integer "user_id", :default => 0, :null => false t.datetime "created_at" t.datetime "updated_at" end - add_index "authors", ["authentication_token"], :name => "index_authors_on_authentication_token", :unique => true - add_index "authors", ["confirmation_token"], :name => "index_authors_on_confirmation_token", :unique => true - add_index "authors", ["email"], :name => "index_authors_on_email", :unique => true - add_index "authors", ["reset_password_token"], :name => "index_authors_on_reset_password_token", :unique => true + add_index "authors", ["user_id"], :name => "index_authors_on_user_id", :unique => true create_table "balloon_templates", :force => true do |t| t.integer "speach_balloon_id", :null => false @@ -174,12 +158,12 @@ ActiveRecord::Schema.define(:version => 20120102071851) do end create_table "original_pictures", :force => true do |t| - t.string "ext", :null => false - t.integer "width", :null => false - t.integer "height", :null => false - t.integer "filesize", :null => false - t.integer "artist_id" - t.integer "license_id" + t.string "ext", :null => false + t.integer "width", :null => false + t.integer "height", :null => false + t.integer "filesize", :null => false + t.integer "artist_id", :default => 0, :null => false + t.integer "license_id", :default => 0, :null => false t.datetime "created_at" t.datetime "updated_at" end @@ -196,8 +180,6 @@ ActiveRecord::Schema.define(:version => 20120102071851) do t.integer "t", :default => 1, :null => false t.integer "width", :null => false t.integer "height", :null => false - t.integer "flipv", :default => 0, :null => false - t.integer "fliph", :default => 0, :null => false t.datetime "created_at" t.datetime "updated_at" end @@ -223,13 +205,13 @@ ActiveRecord::Schema.define(:version => 20120102071851) do add_index "panels", ["comic_id", "t"], :name => "panels_idt", :unique => true create_table "resource_pictures", :force => true do |t| - t.string "ext", :null => false - t.integer "width", :null => false - t.integer "height", :null => false - t.integer "filesize", :null => false - t.integer "artist_id" - t.integer "license_id" - t.integer "original_picture_id", :null => false + t.string "ext", :null => false + t.integer "width", :null => false + t.integer "height", :null => false + t.integer "filesize", :null => false + t.integer "artist_id", :default => 0, :null => false + t.integer "license_id", :default => 0, :null => false + t.integer "original_picture_id", :null => false t.datetime "created_at" t.datetime "updated_at" end @@ -282,4 +264,28 @@ ActiveRecord::Schema.define(:version => 20120102071851) do t.datetime "updated_at" end + create_table "users", :force => true do |t| + t.string "email", :default => "", :null => false + t.string "encrypted_password", :limit => 128, :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.string "authentication_token" + t.string "confirmation_token" + t.datetime "confirmed_at" + t.datetime "confirmation_sent_at" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "users", ["authentication_token"], :name => "index_users_on_authentication_token", :unique => true + add_index "users", ["confirmation_token"], :name => "index_users_on_confirmation_token", :unique => true + add_index "users", ["email"], :name => "index_users_on_email", :unique => true + add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true + end