-class AuthorRegistrationsController < Devise::RegistrationsController
+class UserRegistrationsController < Devise::RegistrationsController
protected\r
\r
def after_sign_up_path_for(resource)\r
class Author < ActiveRecord::Base
has_one :artist
+ belongs_to :user
- # Include default devise modules. Others available are:
- # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
- devise :database_authenticatable, :registerable,
- :recoverable, :rememberable, :trackable, :token_authenticatable, :validatable#, :confirmable
-
- # Setup accessible (or protected) attributes for your model
- attr_accessible :id, :name, :password, :password_confirmation, :remember_me #, :email
-
before_save do |r|
r.name = 'no name' if r.name.blank?
end
Artist.find_by_author(self) != nil
end
- def create_token
- self.ensure_authentication_token
- self.save
- end
-
- def delete_token
- self.authentication_token = nil
- self.save
- end
-
def step2 n
self.name = n
self.save
belongs_to :resource_picture
def flip
- res = (self.flipv == 0 ? '' : 'v') + (self.fliph == 0 ? '' : 'h')
+ res = (self.height < 0 ? '' : 'v') + (self.width == 0 ? '' : 'h')
res += '/' unless res.empty?
res
end
--- /dev/null
+class User < ActiveRecord::Base
+ has_one :author
+
+ # Include default devise modules. Others available are:
+ # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
+ devise :database_authenticatable, :registerable,
+ :recoverable, :rememberable, :trackable, :token_authenticatable, :validatable#, :confirmable
+
+ # Setup accessible (or protected) attributes for your model
+ attr_accessible :id, :name, :password, :password_confirmation, :remember_me , :email
+
+ def create_token
+ self.ensure_authentication_token
+ self.save
+ end
+
+ def delete_token
+ self.authentication_token = nil
+ self.save
+ end
+
+end
<th>y</th>
<th>z</th>
<th>t</th>
- <th>flip</th>
<th>updated_at</th>
</tr>
<td><%= panel_picture.t %></td>
<td><%= panel_picture.width %></td>
<td><%= panel_picture.height %></td>
- <td><%= panel_picture.flip %></td>
<td><%= panel_picture.updated_at %></td>
</tr>
<% end %>
<th>t</th>
<th>Width</th>
<th>Height</th>
- <th>flipv</th>
- <th>fliph</th>
<th>created_at</th>
<th>updated_at</th>
</tr>
<td><%= panel_picture.t %></td>
<td><%= panel_picture.width %></td>
<td><%= panel_picture.height %></td>
- <td><%= panel_picture.flipv %></td>
- <td><%= panel_picture.fliph %></td>
<td><%= panel_picture.created_at %></td>
<td><%= panel_picture.updated_at %></td>
</tr>
--- /dev/null
+<p id="notice"><%= notice %></p>
+
+<p>
+ <b>name:</b>
+ <%= h(@author.name) %>
+</p>
+
+<p>
+ <b>email:</b>
+ <%= h(@author.email) %>
+</p>
+
+<p>
+ <b>sign_in_count:</b>
+ <%= @author.sign_in_count %>
+</p>
+
+<p>
+ <b>current_sign_in_at:</b>
+ <%= @author.current_sign_in_at %>
+</p>
+
+<p>
+ <b>last_sign_in_at:</b>
+ <%= @author.last_sign_in_at %>
+</p>
+
+<p>
+ <b>current_sign_in_ip:</b>
+ <%= @author.current_sign_in_ip %>
+</p>
+
+<p>
+ <b>last_sign_in_ip:</b>
+ <%= @author.last_sign_in_ip %>
+</p>
+
+<%= link_to 'Back', :action => :list %>
--- /dev/null
+<h1>Listing system_pictures</h1>
+
+<table>
+ <tr>
+ <th>Ext</th>
+ </tr>
+
+<% @authors.each do |author| %>
+ <tr>
+ <td><%= link_to h(author.name), :action => :show, :id => author.id %></td>
+ </tr>
+<% end %>
+</table>
--- /dev/null
+<h1>Listing authors</h1>
+
+<table>
+ <tr>
+ <th>id</th>
+ <th>name</th>
+ <th>email</th>
+ <th>sign_in_count</th>
+ <th>current_sign_in_at</th>
+ <th>last_sign_in_at</th>
+ <th>current_sign_in_ip</th>
+ <th>last_sign_in_ip</th>
+ <th>created_at</th>
+ <th>updated_at</th>
+ </tr>
+
+<% @authors.each do |author| %>
+ <tr>
+ <td><%= link_to author.id, :action => :show, :id => author.id %></td>
+ <td><%= h(author.name) %></td>
+ <td><%= h(author.email) %></td>
+ <td><%= author.sign_in_count %></td>
+ <td><%= author.current_sign_in_at %></td>
+ <td><%= author.last_sign_in_at %></td>
+ <td><%= author.current_sign_in_ip %></td>
+ <td><%= author.last_sign_in_ip %></td>
+ <td><%= author.created_at %></td>
+ <td><%= author.updated_at %></td>
+ </tr>
+<% end %>
+</table>
--- /dev/null
+<p id="notice"><%= notice %></p>
+
+<p>
+ <b>name:</b>
+ <%= h(@author.name) %>
+</p>
+
+<%= link_to 'Back', :controller => 'authors' %>
Pettanr::Application.routes.draw do
+ devise_for :users, :controllers => { :registrations => "user_registrations" }
devise_for :admins
- devise_for :authors, :controllers => { :registrations => "author_registrations" }
match 'original_pictures/:id(.:format)/refresh' => 'original_pictures#refresh'
+ resources :authors do
+ collection do
+ get :index
+ get :show
+ post :create
+ get :list
+ get :browse
+ end
+ member do
+ put :update
+ delete :destroy
+ end
+ end
resources :artists do
collection do
get :index
--- /dev/null
+class CreateAuthors < ActiveRecord::Migration
+ def change
+ create_table(:authors) do |t|
+ t.string :name\r
+ t.integer :user_id, :null => false, :default => 0\r
+
+ 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
+ end
+
+end
t.integer :t, :null => false, :default => 1
t.integer :width, :null => false
t.integer :height, :null => false
- t.integer :flipv, :null => false, :default => 0
- t.integer :fliph, :null => false, :default => 0
t.timestamps
end
-class DeviseCreateAuthors < ActiveRecord::Migration
+class DeviseCreateUsers < ActiveRecord::Migration
def change
- create_table(:authors) do |t|
- t.string :name\r
+ create_table(:users) do |t|
t.database_authenticatable :null => false
t.recoverable
t.rememberable
--- /dev/null
+require 'spec_helper'
+
+describe User do
+ pending "add some examples to (or delete) #{__FILE__}"
+end