$ rails g model Role name
invoke active_record
create db/migrate/20151014151416_create_roles.rb
create app/models/role.rb
invoke test_unit
create test/models/role_test.rb
create test/fixtures/roles.yml
$ rails g model UserRole user:references role:references
invoke active_record
create db/migrate/20151014151448_create_user_roles.rb
create app/models/user_role.rb
invoke test_unit
create test/models/user_role_test.rb
create test/fixtures/user_roles.yml
$ rake db:migrate
Role.create(name: "platform_admin")
(0.0ms) begin transaction
SQL (0.3ms) INSERT INTO "roles" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-10-14 15:23:08.704450"], ["name", "platform_admin"], ["updated_at", "2015-10-14 15:23:08.704450"]]
(1.2ms) commit transaction
=> #<Role id: 1, name: "platform_admin", created_at: "2015-10-14 15:23:08", updated_at: "2015-10-14 15:23:08">
irb(main):012:0> Role.create(name: "store_admin")
(0.1ms) begin transaction
SQL (0.3ms) INSERT INTO "roles" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-10-14 15:23:12.468088"], ["name", "store_admin"], ["updated_at", "2015-10-14 15:23:12.468088"]]
(1.3ms) commit transaction
=> #<Role id: 2, name: "store_admin", created_at: "2015-10-14 15:23:12", updated_at: "2015-10-14 15:23:12">
irb(main):013:0> Role.create(name: "registered_user")
(0.1ms) begin transaction
SQL (0.3ms) INSERT INTO "roles" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-10-14 15:23:18.850334"], ["name", "registered_user"], ["updated_at", "2015-10-14 15:23:18.850334"]]
(1.2ms) commit transaction
=> #<Role id: 3, name: "registered_user", created_at: "2015-10-14 15:23:18", updated_at: "2015-10-14 15:23:18">
Last active
October 14, 2015 15:32
-
-
Save selfup/c0d9d855352f1800e7c2 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment