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

How to use gem from Rails app (gemfile) #1

Open
thedanielmay opened this issue Dec 22, 2014 · 1 comment
Open

How to use gem from Rails app (gemfile) #1

thedanielmay opened this issue Dec 22, 2014 · 1 comment

Comments

@thedanielmay
Copy link

Hi, so I've got this library bundling into my app via Gemfile:

gem 'thecity-plaza-ruby', '1.0', :git => 'https://github.com/thecity/thecity-plaza-ruby.git'

I've fired up the rails console to kick the tires, but will get errors e.g.

 $ foreman run rails c
Loading development environment (Rails 4.1.8)
2.1.5 :001 > the_city = TheCity.new 'ebcc', false
NameError: uninitialized constant TheCity
    from (irb):1
    from /Users/daniel/.rvm/gems/ruby-2.1.5@pubweb/gems/railties-4.1.8/lib/rails/commands/console.rb:90:in `start'
    from /Users/daniel/.rvm/gems/ruby-2.1.5@pubweb/gems/railties-4.1.8/lib/rails/commands/console.rb:9:in `start'
    from /Users/daniel/.rvm/gems/ruby-2.1.5@pubweb/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:69:in `console'
    from /Users/daniel/.rvm/gems/ruby-2.1.5@pubweb/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
    from /Users/daniel/.rvm/gems/ruby-2.1.5@pubweb/gems/railties-4.1.8/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:4:in `require'

I have successfully queried our instance using this library in standalone fashion, not pulling it into a Rails app and using it.

How do I call the library from Rails app?

@robertleib
Copy link

You might try adding an initializer to your rails app, and include the module there?

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

No branches or pull requests

2 participants