Skip to content

Commit 1a5eeb6

Browse files
committed
Merge branch 'master' into refactor_routes [ci skip]
2 parents c08f7d2 + b56447f commit 1a5eeb6

11 files changed

Lines changed: 99 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## [v0.10.1](https://github.com/graphql-devise/graphql_devise/tree/v0.10.1) (2020-03-21)
4+
5+
[Full Changelog](https://github.com/graphql-devise/graphql_devise/compare/v0.10.0...v0.10.1)
6+
7+
**Fixed bugs:**
8+
9+
- Routes mount\_graphql\_devise\_for with module not work [\#69](https://github.com/graphql-devise/graphql_devise/issues/69)
10+
- Fix mounting models inside another module [\#70](https://github.com/graphql-devise/graphql_devise/pull/70) ([mcelicalderon](https://github.com/mcelicalderon))
11+
312
## [v0.10.0](https://github.com/graphql-devise/graphql_devise/tree/v0.10.0) (2020-02-04)
413

514
[Full Changelog](https://github.com/graphql-devise/graphql_devise/compare/v0.9.2...v0.10.0)

graphql_devise.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
3535
spec.add_development_dependency 'faker'
3636
spec.add_development_dependency 'generator_spec'
3737
spec.add_development_dependency 'github_changelog_generator'
38-
spec.add_development_dependency 'pry'
38+
spec.add_development_dependency 'pry', '~> 0.12.2'
3939
spec.add_development_dependency 'pry-byebug'
4040
spec.add_development_dependency 'rake', '~> 10.0'
4141
spec.add_development_dependency 'rspec-rails'

lib/graphql_devise/rails/routes.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ def mount_graphql_devise_for(resource, opts = {})
3535

3636
devise_for(
3737
resource.pluralize.underscore.tr('/', '_').to_sym,
38-
module: :devise,
39-
skip: DEVISE_OPERATIONS
38+
module: :devise,
39+
class_name: resource,
40+
skip: DEVISE_OPERATIONS
4041
)
4142

4243
prepared_mutations = GraphqlDevise::MutationsPreparer.call(

lib/graphql_devise/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module GraphqlDevise
2-
VERSION = '0.10.0'.freeze
2+
VERSION = '0.10.1'.freeze
33
end

spec/dummy/app/models/users.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Users
2+
def self.table_name_prefix
3+
'users_'
4+
end
5+
end
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module Users
2+
class Customer < ApplicationRecord
3+
devise :database_authenticatable, :validatable
4+
5+
include GraphqlDevise::Concerns::Model
6+
7+
validates :name, presence: true
8+
end
9+
end

spec/dummy/config/routes.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,11 @@
2121
at: '/api/v1/guest/graphql_auth'
2222
)
2323

24+
mount_graphql_devise_for(
25+
'Users::Customer',
26+
only: [:login],
27+
at: '/api/v1/user_customer/graphql_auth'
28+
)
29+
2430
post '/api/v1/graphql', to: 'api/v1/graphql#graphql'
2531
end
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
class CreateUsersCustomers < ActiveRecord::Migration[6.0]
2+
def change
3+
create_table :users_customers do |t|
4+
## Required
5+
t.string :provider, null: false, default: 'email'
6+
t.string :uid, null: false, default: ''
7+
8+
## Database authenticatable
9+
t.string :encrypted_password, null: false, default: ''
10+
11+
## User Info
12+
t.string :email
13+
14+
## Tokens
15+
t.text :tokens
16+
17+
t.string :name, null: false
18+
19+
t.timestamps
20+
end
21+
end
22+
end

spec/dummy/db/schema.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema.define(version: 2019_10_13_213045) do
13+
ActiveRecord::Schema.define(version: 2020_03_21_121807) do
1414

1515
create_table "admins", force: :cascade do |t|
1616
t.string "provider", default: "email", null: false
@@ -87,4 +87,15 @@
8787
t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true
8888
end
8989

90+
create_table "users_customers", force: :cascade do |t|
91+
t.string "provider", default: "email", null: false
92+
t.string "uid", default: "", null: false
93+
t.string "encrypted_password", default: "", null: false
94+
t.string "email"
95+
t.text "tokens"
96+
t.string "name", null: false
97+
t.datetime "created_at", precision: 6, null: false
98+
t.datetime "updated_at", precision: 6, null: false
99+
end
100+
90101
end

spec/factories/users_customers.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FactoryBot.define do
2+
factory :users_customer, class: 'Users::Customer' do
3+
name { Faker::FunnyName.two_word_name }
4+
email { Faker::Internet.unique.email }
5+
password { Faker::Internet.password }
6+
end
7+
end

0 commit comments

Comments
 (0)