Guest User

Untitled

a guest
Apr 23rd, 2018
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. # migracja
  2. class CreateUsers < ActiveRecord::Migration
  3. def self.up
  4. create_table "users", :force => true do |t|
  5. t.column :login, :string
  6. t.column :email, :string
  7. t.column :crypted_password, :string, :limit => 40
  8. t.column :salt, :string, :limit => 40
  9. t.column :created_at, :datetime
  10. t.column :updated_at, :datetime
  11. t.column :remember_token, :string
  12. t.column :remember_token_expires_at, :datetime
  13. # powyżej dostarczone przez plugin
  14. t.column :name, :string, :limit => 128, :null => false
  15. t.column :role, :string, :limit => 40
  16. end
  17. end
  18.  
  19. def self.down
  20. drop_table "users"
  21. end
  22. end
  23.  
  24. # klasy
  25. class User < ActiveRecord::Base
  26. # Klasa z RESTful Authentication
  27. end
  28.  
  29. class Student < User
  30. end
  31.  
  32. # consola
  33. >> s = Student.new(:login => "nowy", :name => "Nowe nazwisko", :email => "email@nowy.pl", :password => "hasło", :password_confirmation => "hasło")
  34.  
  35. >> s.name
  36. => nil
Add Comment
Please, Sign In to add comment