Megazoor

Joined

670 Experience
5 Lessons Completed
0 Questions Solved

Activity

that works now thanks!!

I am wondering... if i wanted to pass the Signup data from the app directly to the rails api to signup or sign in without redirecting to the webview how would i go about that?
<3

Hello! I finished your rails api - react-native demo and am begging for more react-native rails demonstrations... I am building a game with rails/react now using your tutorial as my base layer for using the api and setting up the env.

I have added an index var to the users class and am returning the proper json in /api/v1/index.json but when i try to add my serialzer its not recognizing it... i am still in the user class and have the route ad everything setup... wondering what im doing wrong?? Heres the code::

# users_controller.rb

 def index
     @index = render json: User.all, adapter: :json
  end 
#   routes.rb

  namespace :api do
    namespace :v1 do
      get '/me' => "users#me"
      get '/index' => "users#index"
    end
  end
# /views/api/v1/users/index.json.jbuilder

json.array! @index do |user|
  json.id user.id
  json.email user.email
  json.name user.name
  json.avatar_url gravatar_image_url(user.email, size: 40)
end

Running
$ rails g scaffold Poop

returns:

Running via Spring preloader in process 13525
invoke active_record
create db/migrate/20181928173828_create_models.rb
create app/models/model.rb
invoke test_unit
create test/models/model_test.rb
create test/fixtures/models.yml
invoke resource_route
route resources :models
invoke scaffold_controller
create app/controllers/poops_controller.rb
invoke erb
create app/views/models
create app/views/models/index.html.erb
create app/views/models/edit.html.erb
create app/views/models/show.html.erb
create app/views/models/new.html.erb
create app/views/models/_form.html.erb
(erb):1:in template': undefined local variable or methodmodel_resource_name' for #Erb::Generators::ScaffoldGenerator:0x007fa59de06e48 (NameError)
from /Users/username/.rubies/ruby-2.4.1/lib/ruby/2.4.0/erb.rb:896:in eval'
from /Users/username/.rubies/ruby-2.4.1/lib/ruby/2.4.0/erb.rb:896:in
result'

Posted in Doorkeeper Omniauth OAuth Client Discussion

When i run a scaffold i get this error:

(erb):1:in template': undefined local variable or methodmodel_resource_name' for #Erb::Generators::ScaffoldGenerator:0x007fa59de06e48 (NameError)

Please help, this is incredibly confusing...

Posted in Doorkeeper Omniauth OAuth Client Discussion

Thanks i did just notice my api key changed and fixed that.

Posted in Doorkeeper Omniauth OAuth Client Discussion

Also having this issue when i try to login from the client to my provider...

No route matches [GET] "/oauth/authorize"
Rails.root: /Users/username/project/my_client

Posted in Doorkeeper Omniauth OAuth Client Discussion

thank you for your response, I removed the files i had created and ran the scaffold... now just getting this back

Started GET "/api/v1/tweets.json" for ::1 at 2018-10-02 03:37:14 -0400
Processing by Api::V1::TweetsController#index as JSON
Filter chain halted as :doorkeeper_authorize! rendered or redirected
Completed 401 Unauthorized in 1ms (ActiveRecord: 0.0ms)

Posted in Doorkeeper Omniauth OAuth Client Discussion

@17:32

You did not show the process of creating the tweets.json scaffold... I realize you think you went over enough to have this be obvious but at this point its not, i went through and created all of the files manually you have in your repoistory but am getting

uninitialized constant Api::V1::TweetsController::Tweet
# GET /tweets.json
def index
@tweets = Tweet.all
render "tweets/index"
end

Posted in API Authentication with an OAuth Provider Discussion

My solution was:

      before_action :doorkeeper_authorize!, unless: :user_signed_in?

      def current_resource_owner
        @current_user ||= if doorkeeper_token
          User.find(doorkeeper_token.resource_owner_id)
        else
          warden.authenticate(scope: :user)
        end
      end
logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.