Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with Ruby on Rails. #5

Open
prdpspkt opened this issue Nov 8, 2016 · 3 comments
Open

Not working with Ruby on Rails. #5

prdpspkt opened this issue Nov 8, 2016 · 3 comments
Labels

Comments

@prdpspkt
Copy link

prdpspkt commented Nov 8, 2016

I wanted to use your gem in rails and faced these problems.

When I do not include require 'cleverbot'

  1. NameError (uninitialized constant MessengerController::Cleverbot)
    then I just added require 'cleverbot' to controller and again I got problem
    When I include require 'cleverbot'
  2. Cleverbot::Errors::DuplicatedReferenceNamesError (Reference name already exists.):

Please help.

@elifoster
Copy link
Member

Can you provide your controller code?

The reference name error is quite simple; you are reusing the reference name.

@prdpspkt
Copy link
Author

prdpspkt commented Nov 10, 2016

This is my controller code

class MessengerController < Messenger::MessengerController
  def webhook
    friend = Cleverbot.new('user', 'key', 'Pradeep Sapkota')
    if fb_params.first_entry.callback.message?
      text = Messenger::Elements::Text.new(text: friend.say("I'm Under heavy development. Please meet me later. Thank you for your patience").to_s)
      request = Messenger::Request.new(text, fb_params.first_entry.sender_id)
      response = Messenger::Client.send(request)
      puts response
    end
    render nothing: true, status: 200
  end
end

@elifoster
Copy link
Member

@dtesler I still don't really understand the whole reference nick thing. Can you help out here? Otherwise I'm just going to recommend not setting the reference nick because it doesn't make a lot of sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants