rubygems

Rails Gem::LoadError in UsersController#new

时光毁灭记忆、已成空白 提交于 2019-12-25 06:11:28
问题 New to Ruby on Rails and having a problem when following Michael Hartl's tutorial.I'm using Rails 3.2.2 with Ruby 1.9.3. The issue looks very similar to another question that was raised but was unanswered: Rails Error NoMethodError in UsersController#show error I get the following error when attempting to add a new user via /signup Gem::LoadError in UsersController#new bcrypt-ruby is not part of the bundle. Add it to Gemfile. Reloading the page gives the error: NoMethodError in

How to define a method from a gem to use within a model?

北城以北 提交于 2019-12-25 05:25:30
问题 I'm trying to build a gem and I want to define a method my_method inside the gem and use it inside a model. Example: class MyModel < ActiveRecord::Base my_method end My gem: #lib/my_gem.rb require "my_gem/model_inclusions" module MyGem end #lib/my_gem/model_inclusions.rb module MyGem def self.included(base) base.extend ClassMethods end module ClassMethods def my_method end end end When I try the example it gives me undefined method 'my_method' for <Class:0x00000045434> (NoMethodError) 回答1:

RVM Gempath not being set

一世执手 提交于 2019-12-25 05:22:12
问题 I recently installed RVM. After loading my .rvmrc I tried bundle install and got the error informing me bundler was not installed. After installing bundler , the bundler not installed error persisted. After some quick digging I discovered that the RVM gem paths are not being used by rubygems. Here is gem env : RubyGems Environment: - RUBYGEMS VERSION: 1.8.24 - RUBY VERSION: 1.9.2 (2011-07-09 patchlevel 290) [x86_64-linux] - INSTALLATION DIRECTORY: /home/jhalecom/ruby/gems - RUBY EXECUTABLE:

RVM Gempath not being set

半腔热情 提交于 2019-12-25 05:22:08
问题 I recently installed RVM. After loading my .rvmrc I tried bundle install and got the error informing me bundler was not installed. After installing bundler , the bundler not installed error persisted. After some quick digging I discovered that the RVM gem paths are not being used by rubygems. Here is gem env : RubyGems Environment: - RUBYGEMS VERSION: 1.8.24 - RUBY VERSION: 1.9.2 (2011-07-09 patchlevel 290) [x86_64-linux] - INSTALLATION DIRECTORY: /home/jhalecom/ruby/gems - RUBY EXECUTABLE:

Why prawnto gem installs rails 3.x when there is already a rails 2.x?

[亡魂溺海] 提交于 2019-12-25 05:12:13
问题 I have rails (2.3.5) and prawn (0.12.0) installed. When I install prawnto , gem installs rails version 3.2.6 also. The dependency of prawnto is: prawn >= 0 rails >= 2.1 Why gem install Rails 3.x when the prawnto dependency is already there? 回答1: tl;dr Use Bundler. It rocks. Alright, this is basically down to how dependency resolution works in RubyGems. If you're not terribly familiar with it, get up to speed real quick like with the Primer panel from this XKCD comic. RubyGems dependency

Why prawnto gem installs rails 3.x when there is already a rails 2.x?

可紊 提交于 2019-12-25 05:11:11
问题 I have rails (2.3.5) and prawn (0.12.0) installed. When I install prawnto , gem installs rails version 3.2.6 also. The dependency of prawnto is: prawn >= 0 rails >= 2.1 Why gem install Rails 3.x when the prawnto dependency is already there? 回答1: tl;dr Use Bundler. It rocks. Alright, this is basically down to how dependency resolution works in RubyGems. If you're not terribly familiar with it, get up to speed real quick like with the Primer panel from this XKCD comic. RubyGems dependency

Creating a gem using Jruby and not Ruby

家住魔仙堡 提交于 2019-12-25 04:15:24
问题 So I was successful in writing a jruby file and reading from a jar file. I also created a seperate Ruby gem, installed it and used it successfully. I would like to write a gem using Jruby (and not ruby). When I did try to do so and after installing the gem, it gave me the following error: `require': cannot load such file -- java (LoadError) Is there a specific way to write a gem using jruby that is different from the way to write a gem usig ruby? If so, please direct me to a useful tutorial

bundle cannot load such file bundler-1.17.1/exe/bundle

回眸只為那壹抹淺笑 提交于 2019-12-25 03:49:17
问题 I had a problem with FileUtils and I had to uninstall the gem. After did this, I did gem update --default and some gems have been updated. That fixed my problem with FileUtils but now, bundler is dead. If I try bundle info xxx I get this error: Traceback (most recent call last): 1: from /Users/robin/.gem/ruby/2.5.1/bin/bundle:23:in `<main>' /Users/robin/.gem/ruby/2.5.1/bin/bundle:23:in `load': cannot load such file -- /Users/robin/.rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/exe

Bundle install selected group into custom path

a 夏天 提交于 2019-12-25 03:48:07
问题 As a follow up to Bundle deployment only for selected gems, using the solution of blacklisting using --without option, for example: group :runtime do gem 'rails' ... end group :runtime_unpackaged do gem 'less2sass' end The runtime_unpackaged can be installed using the command: bundle --path vendor/bundle --without runtime The runtime group is installed through debian packages as the application itself is packaged as a .deb package. But then all other gems at group runtime won't be handled

How to get individual tumblr post's likes count for tumblr_client gem

二次信任 提交于 2019-12-25 03:03:27
问题 I am trying to get likes count for inidividual tumblr posts. I can only seem to get the total likes of the user and also reblog/note_count. Refer to code below. user = Authentication.where(user_id: current_user.id, provider: "tumblr").first oauth_id = user.uid oauth_access_token = user.token oauth_password = user.token_secret client = Tumblr::Client.new(:client => :httpclient) mytumblr = client.posts("testing.tumblr.com", :limit => 10) mytumblr["posts"].each do |posts| p posts["id"] p posts[