Menu
  • HOME
  • TAGS

How can I avoid bundlers warning about multiple sources when I have all gems in my .gemspec?

ruby,rubygems,bundler,gemspecs

No, you'll either need to mute the warning or add the source block to your Gemfile with the specific gems you want to come from your private server. There isn't a need to duplicate the ones that come from rubygems.org (or you could do it the other way around, if...

Syntax error with rubygem elasticsearch

ruby,elasticsearch,rubygems

You seem to use Ruby prior to 1.9 version. If so, either update Ruby (which is recommended), or use old rocket-hash syntax: client = Elasticsearch.new :log => true ...

Adding Ruby Gems to my PuPHPet provisioner

rubygems,vagrant,puppet,puphpet

You want the Ruby tab, in the Languages section. ...

How does an executable within a gem reference the greater gem?

ruby,rubygems

I usually add the lib dir to the library load path ($:). You can add this to the top of your bin file. lib = File.expand_path('../../lib', __FILE__) $:.unshift(lib) unless $:.include?(lib) Then you can do a normal require: require 'videoplayer' Hope this helps....

mysql ruby gem not installing on Windows 7

mysql,ruby,windows-7,gem,rubygems

The 'mysql' and 'mysql2' packages/extensions/gems don't work with the x64 bit version of Ruby on Windows 7 (or any 64 bit version of Windows). You need to install the x86 (32) bit version of Ruby for them to work. So I repeated step 3 in my question, and installed...

Circular dependency on Gemfile

ruby-on-rails,ruby,gem,rubygems,countries

Oh, sorry, I didn’t get this at the first glance. casein gem references itself: Puelos-Macbook:ChataBackend paulo$ gem dependency casein Gem casein-5.0.0.0 authlogic (= 3.4.2) !! NB⇒ casein (>= 0) jquery-rails (>= 0) scrypt (= 1.2.1) will_paginate (= 3.0.5) It was allowed for bundle prior to 1.9, but disallowed now. You...

How can i parse a user object to return a screen name and move on to my next step?

javascript,json,api,twitter,rubygems

You need to [ require 'json' ] at the beginning of your code. Your username will be encoded in response.body, but you need to call JSON.parse on it to decode it properly. So you have to answer after # ADD CODE TO PARSE THE RESPONSE BODY HERE : user =...

gem install fails with “Could not find a valid gem 'yaml'”

ruby,gem,rubygems

There is no yaml gem (https://rubygems.org/search?query=yaml). yaml is part of Ruby. Therefore just remove s.add_runtime_dependency 'yaml' from your gemspec and just add require 'yaml' to the file in which you want to use YAML.

using devise WITHOUT the gem, can I simply copy the files?

ruby-on-rails,ruby,devise,gem,rubygems

See http://bundler.io/v1.5/git.html Bundler also allows you to work against a git repository locally instead of using the remote version. This can be achieved by setting up a local override: bundle config local.GEM_NAME /path/to/local/git/repository Also http://ryanbigg.com/2013/08/bundler-local-paths/ "There's a little known feature of Bundler that allows you to use a local Git...

Curb v 0.8.5 won't install on Ubuntu 14.04

ruby,gem,rubygems,ubuntu-14.04

The problem is likely with checking for Ruby 1.9 Hash... no (look for this string in your output.) It results in implicit declaration of function ‘RHASH’ and everything failed. I personally have no problem installing this gem on ruby2. I would suggest you to re-install ruby2 and that probably should...

Programmatically check if gem in bundle?

ruby,rubygems,bundler

Bundler is used to set up the applications gems, so you can use the Gem API rather than Bundler: Gem.loaded_specs.has_key? gem_name Bundler will have set things up so that any gems in the bundle (in the appropriate groups) have been activated (so they will have entries in loaded_specs) and any...

Rails doesn't load actionform gem from Gemfile

ruby-on-rails,gem,rubygems,bundler

The problem is a mismatch between the gem name and the file inside the gem. Because the gem is named 'actionform', Bundler will try to require 'actionform', however the file is actually called action_form. You can tell Bundler the right file name with this syntax: gem 'actionform', :github => 'rails/actionform',...

could not locate gemfile in ruby tutorial

ruby-on-rails,gem,rubygems

Once you create the app, you need to change into its directory to execute Bundler commands. (Based on the excerpts in your question, it appears that you're still in workspace, while the Gemfile is located in toy_app.) For example: $ rails new blah_app $ cd blah_app $ bundle (whatever) ...

How to change bundle environment when running the other ruby app

ruby,rubygems,bundler

I suspect you are looking for Bundler.with_clean_env: #/home/user/a/test.rb Bundler.with_clean_env do # this assumes b/test.rb sets up Bundler itself `/home/user/b/test.rb` end There is also clean_exec and clean_system which wrap system and exec, which might be simpler in this case (since you don’t use the result of the backticks): Bundler.clean_system '/home/user/b/test.rb' ...

how to specify namespace in SOAP request with 'savon' gem?

ruby,soap,rubygems,savon

I noticed that on line 5820 of the WSDL file the location looks like this: <soap:address location="{endpoint address}"/> Could it be the problem? Edited 1. Open up in your browser: https://partnertest.payback.in/PBExternalServices/v1/soap?wsdl Search for {endpoint address} string on the page. I'm far from understand this particular WSDL document, but I wonder...

Using cron and ruby

ruby,cron,rubygems

Ok. After a couple of hours I finally solved this problem. And the solution is very easy. I don't know, why it's working only that way. So, the solution: 1.Create bash script with this content: #!/usr/bin/env bash /Users/username/.rvm/gems/ruby-2.2.0/wrappers/ruby /path/to/your/ruby_script.rb 2. Configure cron file: SHELL = /bin/bash * * * *...

Cannot load gem during gem pristine

ruby-on-rails,ruby,rubygems,ubuntu-14.04

Hi all I ended up finding a post that recommended I just reinstall ruby again. Seeing no other choice I did a rvm uninstall ruby then a rvm install ruby and set everything else back up and it went well. Unsatisfying but true :-P

How do I send simple mails from a gem, without requiring ActionMailer, but using its configuration if present?

ruby,email,configuration,rubygems,actionmailer

I figured it out. Basically, wrap_delivery_behavior is what copies the ActionMailer configuration into Mail, so calling wrap_delivery_behavior if ActionMailer is defined solves the problem: mail = Mail.new do from recipient to recipient subject subject body body end if defined?(ActionMailer) ActionMailer::Base.wrap_delivery_behavior(mail) end mail.deliver! That works exactly as I needed it to...

OpenBSD unable to install therubyracer gem ERROR: Failed to build gem native extension

ruby-on-rails,ruby,rubygems,bundler,openbsd

I was unable to install therubyracer gem in OpenBSD. As a workaround, i have installed nodejs as javascript runtime using OpenBSD package manager. pkg install node and removed therubyracer gem from Gemfile. Then bundle install works fine without any issue....

Figaro “undefined method `require_keys' for Figaro:Module (NoMethodError)”

ruby-on-rails,ruby,ruby-on-rails-4,rubygems,environment-variables

Figaro.require_keys was added in version 1.0. It was previously called Figaro.require. Either upgrade figaro to 1.x or use the require method. https://github.com/laserlemon/figaro/blame/master/CHANGELOG.md#L6...

Executable gem - Windows

ruby,windows,rubygems

A gem is not executable itself, it is a bundled collection of Ruby scripts and other files which can be executable. You can compare it with a Zip file. The purpose is to easily distribute your projects tot other computers. When you gem install the gem and require the gem...

Cannot require ruby files from a directory other then the one with main files (LoadError)

ruby,gem,rubygems,require

require searches in your $LOAD_PATH. require should generally be used if you want to use a gem that is installed on your system. For your purposes you want to use require_relative: require_relative 'riverbattle/version' Note that at first glance require './riverbattle/version' might also seem to work. However, . here points to...

Run “Bundle Install” w/o Installing a Specific Dependency Gem - Rails

ruby-on-rails,windows,rubygems,bundler,hiredis

You can find the gem which uses the hiredis, from the Gemfile.lock. Search for hiredis, and check to see under which Gem is that hiredis appearing.

Ruby on Rails 4.2.2 ArgumentError (wrong number of arguments (2 for 1)) [duplicate]

ruby-on-rails,ruby,rubygems

The log mentions version 1.6.3 of rack. Try adding gem 'rack', '1.6.2' to your Gemfile and running bundle update rack from the command line. Restart your server. That seems to work, for now.

qpid_messaging ruby gem compilation fails (Apache Qpid messaging api)

ubuntu,compilation,rubygems,qpid

Meanwhile I solved the issue. I fetched the last stable cpp from https://qpid.apache.org/components/cpp-broker/index.html and compiled and installed it with cmake, then gem installs succesfully

Rails, default.js is empty, and jquery and jquery_ujs not loaded

jquery,ruby-on-rails,ruby,ruby-on-rails-4,rubygems

Everything is OK from your side. You said that you're on Windows 7, I also experienced this problem once when I needed to run rails on windows for some reason. Than I found an answer here which helped me to get out of this problem. Actually coffee-script-source, v 1.9.x gives...

how can I install gem from source on local machine? [duplicate]

ruby,rubygems

if you have the full source code no need to use :git notation, just go to to folder and do gem build GEMNAME.gemspec gem install gemname-version.gem ...

How to use pry-byebug in an example script for a gem?

ruby,debugging,gem,rubygems,pry

Ok, looking into this more I realized (I think...still kind of new to the game) a couple things -- 1.) If you want to if have require 'pry' at the top of your ruby file and have it work in general, it would help to install it in your development...

gem: command not found

ruby,rubygems,docker

I have found the answer - use -c -l: ~ » docker run -it -v /mnt/lacie/online/btsync/development:/src stack_rvm /bin/bash -c -l /src/build.sh ...

How to install a rubygem from inside a ruby script and require this gem afterwards?

ruby,gem,rubygems

I found this discussion: https://www.ruby-forum.com/topic/131346 Obviously calling Gem.clear_paths solves the issue. In total: begin require 'progressbar' rescue LoadError => e puts "exception .. installing with gem" h = system 'gem install progressbar' puts "gem installed #{h}" Gem.clear_paths require 'progressbar' end pbar = ProgressBar.new("test", 100) 100.times {sleep(0.1); pbar.inc}; pbar.finish ...

Rails Gem for twitter follow like functions between users

ruby-on-rails-4,gem,rubygems,twitter-follow

There are a couple gem solutions out there you might want to take a look at: Acts as Follower https://github.com/tcocca/acts_as_follower Amistad https://github.com/raw1z/amistad Whether or not you write from scratch is really a question of how much control you want over the final product. If you or someone you're working with/for...

How to add require 'zip/zip' and 'zip' in Gem file

ruby-on-rails,rubygems,rubyzip

The zip-zip is gem so you can write it in Gemfile. The zip however is an Array method, so you can use it without having to require.

unable to delete file from amazon s3 using ruby script

ruby,amazon-web-services,amazon-s3,rubygems

Looking at the documentation (http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/S3/S3Object.html) I think it should look like this (note the square brackets and that the object's key does not include the domain and instead of creating object of Aws::S3::Resource create object of AWS::S3 class): bucket = s3.buckets['some-bucket'] obj = bucket.objects['38ac8226-fa72-4aee-8c3d-a34a1db77b91/some_image.jpg'] obj.delete ...

How can I run a custom version of dpl on Travis CI?

rubygems,travis-ci

The use of edge: local is currently broken in the Travis build environment, caused by ruby gems version 2.4.5. Ruby gems v1.x the --local flag would scan the current working directory for gems of any version. However ruby gems v2.x no longer does this and requires you to use the...

Can't install Nokogiri 1.4.3 gem

ruby-on-rails,rubygems,rvm,nokogiri

I managed to get 1.4.7 to install by doing (close to) the following: git clone [email protected]:sparklemotion/nokogiri.git cd nokogiri gem install rake-compiler hoe racc rexical git checkout v1.4.7 # 1.4.3 in your case # edit ./ext/nokogiri/extconf.rb and replace `Config` with `RbConfig` rake install_deps rake install_gem Hopefully I didn't forget a step....

Why is bundler insisting on an exact gem version number when the gemspec states an open constraint?

ruby-on-rails,ruby,rubygems,bundler,travis-ci

I must admit that is not Travis-specific problem. ⌚ 17:10:45 ▷ /tmp/koudoku ▷ ⭠ master ▷ bundle Fetching gem metadata from http://rubygems.org/....... Resolving dependencies........ Bundler could not find compatible versions for gem "rack": In Gemfile: rspec-rails (~> 2.14.0) ruby depends on actionpack (>= 3.0) ruby depends on rack (~> 1.2.1) ruby...

File comparison using ruby

ruby,ruby-on-rails-3,rubygems

Yes, I had this issue when I was testing this in my terminal. require 'diffy' in terminal has solved my problem.

Make responders gem a dependency in gemspec?

ruby-on-rails,ruby,gem,rubygems

I was being too strict with the gem dependency. It needed to be: s.add_dependency 'responders', '~> 2.0' ...

Installing optipng with homebrew: command not found (rbenv?)

osx,terminal,rubygems,homebrew,rbenv

Ok i found out that I had the image_optim_bin gem in one of my projects installed, after uninstalling this gem for all ruby versions, the command finally works! $ gem uninstall image_optim_bin Remove executables: advdef, advmng, advpng, advzip, jpegoptim, jpegtran, optipng, pngcrush, pngout in addition to the gem? [Yn] Removing...

Install ruby gem feedjira on codingground online coding platform

ruby,rubygems

It showed that a dependency to libcurl was missing, wich is used by curb, which is a dependency of feedjira. Finally I switched to Cloud9 https://c9.io/ for simple online ruby programming, because it gives you more freedom. Unfortunately you have to sign up for this....

cap command not found [Cygwin + Capistrano]

ruby-on-rails,gem,rubygems,cygwin,capistrano

I created a cap file in /usr/local/bin/ and made it executable. $ cat /usr/local/bin/cap #!/bin/bash ruby ~/.gem/ruby/gems/capistrano-3.3.5/bin/cap "[email protected]" Location of capistrano gem files can be found using gem which capistrano. I personally do not know if this is the best way of doing it, but I've just set it up...

Where to get versions suitability sheet of neat and bourbon?

sass,rubygems,bourbon

The compatibility issues that Bourbon had with Libsass got sorted out quite some time ago, and that thread is from last year. Do you mind posting your compiling error? If you try to install a gem without a version, it will grab the newest one, so you would want to...

Error installing Ruby in Rails in Maverick

ruby-on-rails,rubygems,extconf.rb

Run this command: xcode-select --install ...

Using command-line gem 'github-pages-health-check' fails on Mac OS X with rvm

ruby,gem,rubygems

Perhaps you're simply misunderstanding how to use this gem – where are you getting the impression it comes with a check binary? I found the gem source on GitHub. The README doesn't mention such a binary. It does mention a local variable by that name, in Ruby code. Nor is...

Cancancan in a engine

ruby-on-rails,ruby,ruby-on-rails-4,rubygems,cancancan

I could solve my problem by updating Cancancan from 1.9.2 to actual 1.10.1 and compare my engine with the one from this post: https://github.com/CanCanCommunity/cancancan/issues/151#issuecomment-69487040

How to list gem dependencies for some non-intalled gem?

ruby-on-rails,ruby,gem,rubygems

Found the real answer to the question: RubyGems.org gem dependency rails Gem rails-4.1.6 actionmailer (= 4.1.6) actionpack (= 4.1.6) actionview (= 4.1.6) activemodel (= 4.1.6) activerecord (= 4.1.6) activesupport (= 4.1.6) bundler (< 2.0, >= 1.3.0) railties (= 4.1.6) sprockets-rails (~> 2.0) or Gemfile.lock rails (4.1.6) actionmailer (= 4.1.6) actionpack...

Can't access RubyGems - possibly due to SSL? [duplicate]

ruby-on-rails,ruby,ssl,rubygems

Here is a quick solution: Go to your gem file and change source 'https://rubygems.org' to source 'http://rubygems.org' #remove the 's' Check this similar question on StackOverflow for more solutions and insights into the error :) Edit: Based on inputs by @Anthony in the comments below, here is a more permanent...

bundle install is not successful cannot install ffi 1.9.9 osx 10.9

rubygems,ffi

Thanks God, I was able to solve the problem,,, Turned out to be that one of the requirements is to have the "Command Line Tools" already installed on the system [using: Mac OSX 10.9] I was counting on that I already have "Xcode" installed, thats why I thought that "Command...

Installing nginx as a ruby gem vs using apt-get

ruby,nginx,rubygems,ubuntu-14.04,apt-get

Is there any difference in the functionality/limitations to installing it as a gem than by using apt-get? - I'm worried that it won't work for non-ruby applications if it is gem installed? There aren't any limitations on the version of Nginx that Passenger installs for you. You should be...

Ruby woes - gems won't work, “could not find valid gem 'sass'” port 443 [duplicate]

ruby,sass,rubygems

Generally this is the result of a super strict application firewall setting. Sometimes applications are restricted in the sorts of external connections they can make and this can interfere with the Ruby Gem downloading process. Make sure your Ruby process has access to port 443 when making external connections....

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension Linux Mint

ruby,ruby-on-rails-4,heroku,rubygems,bundler

Try using an older version of ffi. For example, in your Gemfile, put: gem 'ffi', '1.9.3' ...

Rubygems: specify dependency on the latest version of a gem

ruby,gem,rubygems,bundler

How about something like this: require 'json' require 'uri' require 'open-uri' nokogiri_uri = URI('https://rubygems.org/api/v1/gems/nokogiri.json') version = nil open(nokogiri_uri) do |f| json_str = f.read puts json_str hash = JSON.parse json_str version = hash['version'] puts version end if version spec.add_dependency "nokogiri", version else puts "My gem won't work because its dependencies are...

Connecting to a SQL server using watir web driver

ruby,sql-server,automation,rubygems,watir-webdriver

As Aetherus has said in the comments, watir-webdriver is only an automation tool for web browsers. It runs in ruby, which means that to get the values from the SQL database you can use any ruby gem you like. A good suggestion would be TinyTDS - https://github.com/rails-sqlserver/tiny_tds.

Bundler: using shared gem when it exists, rather than downloading from gem server

ruby,gem,rubygems,bundler,gemfile

This is the current behavior. When running gem install, directly or via bundle install, gem will first build a dependency graph with all the needed gems. If the gem is found locally it will use it, otherwise it will try to download it from the specified source. If you want,...

Ruby gem install

ruby,gem,rubygems

When i use gem install ocra the latest version is being installed, version 1.3.4 If you want another version you do it like this C:\devkit>gem install ocra -v 1.3.1 Successfully installed ocra-1.3.1 1 gem installed Installing ri documentation for ocra-1.3.1... Installing RDoc documentation for ocra-1.3.1... ...

How to access the class name inside the gem code

ruby-on-rails,ruby,gem,rubygems

Ok I figured this out, @ChrisHeald's answer was close to correct, but a small detail was messing this up, here's what worked for me module LocalInstanceMethods def self.included(klass) define_method "other_#{klass.name.underscore.pluralize}" do end end end The part class < klass was messing up the self and klass variables together, without it...

accepts_nested_attributes_for creating duplicates

ruby-on-rails,ruby,ruby-on-rails-4,rubygems,strong-parameters

Your params: params = {"utf8"=>"✓" "article"=> { "data_id"=>"dfe9e32c-3e7c-4b33-96b6-53b123d70e7a", "name"=>"Mass", "description"=>"mass", "status"=>"active", "volume"=>"dfg", "issue"=>"srf", "iscode"=>"sdg", "image"=>{"title"=>"", "caption"=>"", "root_image_id"=>""}, "article_collections_attributes"=> [ {"name"=>"abcd", "type"=>"Special", "description"=>"content ","ordering_type"=>""} ] }, "commit"=>"Save", "id"=>"b8c8ad67-9b98-4705-8b01-8c3f00e55919"} You...

rake aborted! Ruby on rails

ruby-on-rails,ruby,ruby-on-rails-3,gem,rubygems

minitest-reporters is a separate gem from Minitest. You should add the following to your Gemfile: group :test do gem 'minitest-reporters' end Re-run bundle, and it should solve your problem....

Calling another Gem as a program from my Gem

ruby,shell,command-line,gem,rubygems

You can add jekyll to your gems list of dependencies, by adding the following to your gem's .gemspec file. That means whenever someone installs your gem, jekyll would also be installed. spec.add_dependency 'jekyll' ...

Destroying UpVotes on acts_as_votable

ruby-on-rails,ruby,rubygems,public-activity

For anyone that stumbles across this in future, thanks to Element119 I was eventually able to pinpoint the current users likes on a particular post with a few variables and arel searches. I then destroyed the pinpointed likes. def like @post.create_activity :like, owner: current_user, recipient: @post.user @post.upvote_by current_user redirect_to :back...

What exactly is a gem native extension?

ruby,rubygems

A gem native extension might link to a separate library that needs to be pre-installed, and RMagick is an example of that. However, the term really just means "includes some code that needs to be compiled for your machine". The code is compiled and linked so that the resulting executable...

Ruby byebug never stops

ruby-on-rails,ruby,gem,rubygems,byebug

I had downgrade to a lower version of byebug and it works. Not sure what incompatibilities there may have been with the latest version. Using 3.5.1 worked for me. gem 'byebug', '~> 3.5.1' ...

Ruby Gem or Rails App

ruby,cron,rubygems,whenever

My first question is, is this even gem-worthy? Yes. I would like to be able to make the gem usable on installation without having a user do anything. Use a ./bin directory that contains an executable script, that uses a sleep method. My advice is don't alter the user's...

Create PageObject elements inside a function

ruby,rubygems,watir-webdriver,page-object-gem

Your method should looks like this: def create_element(x) div_element(:id => "something-#{x}") end Method #div is Accessor. It only defines methods for you. It's been desigened to be used in the field of a class....

Gems groups in the Gemfile for rails

ruby-on-rails,gem,rubygems

If you are using the exact gems for all of the environments, you don't need to specify it in group. You can find more about bundler groups here : http://yehudakatz.com/2010/05/09/the-how-and-why-of-bundler-groups/ http://bundler.io/v1.3/groups.html...

Failed to build native extension while installing oily_png

ruby,rubygems,devkit

After a while of googling, I found this issue on the rubygems Github One of the suggested solutions is to downgrade rubygems to 2.3 (I had 2.4 installed) gem update --system 2.3.0 This fixed the problem for me and my bundle completed successfully....

Issue upgrading application to rails 4.2.1 with libv8 & devise & therubyracer

ruby-on-rails,devise,rubygems,v8,libv8

The problem was because of a problem in the libv8 source : https://github.com/cowboyd/libv8/issues/174 It was fixed by installing '3.16.14.7' like this: gem install libv8 -v '3.16.14.7' And that passed, so then adding this to the gemfile: gem 'libv8', '3.16.14.7' ...

How to connect development mode rails app with nginx server?

ruby-on-rails-4,nginx,rubygems

Install nginx Install Passenger Set nginx.conf file according to you Start nginx Go through localhost your nginx page will start gem install passenger in your project passenger-install-nginx-module passenger start For more details got through this link: https://www.phusionpassenger.com/documentation/Users%20guide%20Nginx.html#install_on_debian_ubuntu...

Bundle update installs gems into ~/.rvm/gems/[email protected]_rails_4_0

ruby-on-rails,ruby,gem,rubygems

The path ~/.rvm/gems/ indicates that you are using RVM. The name railstutorial_rails_4_0 after the @ is an RVM gemset. You likely have a .ruby-gemset file inside your project, containing the name of the gemset. RVM automatically switches to it when found....

To generate one for the first time: rails generate symmetric_encryption:config, getting warning, how to fix?

ruby-on-rails,ruby,ruby-on-rails-4,ruby-on-rails-3.2,rubygems

It is mean that your application using symmetric-encryption gem. Here is detail information about configuration of this gem.

LoadError when creating ruby gem

ruby,gem,rubygems,require

1. #require tries to load an absolute path, and if it fails it loads from $:, to add your current directory run the script like this (bash, otherwise use apropriate method to define environment variables for your shell): RUBYLIB="." ruby riverbattle.rb In your base.rb require as follows: require 'riverbattle/game' 2....

Get all dependencies of a specific version of a Gem on RubyGems

ruby-on-rails,ruby,rubygems

I found the solution. The best (and only way) is to use the dependency file of a gem, who list all dependencies of each version of the gem. To get this file, it's necessary to call the dependency address of the API : http://guides.rubygems.org/rubygems-org-api/#misc-methods (the last one). After that, this...

Organise long strings in Rails Testing?

ruby-on-rails,gem,rubygems

IMHO you could just put that stuff in spec/fixtures/approved_responses and do something like: expect(response.body).to eql File.open( fixture_path.join('approved_responses/response_XYZ').read ) ...

How to use the “select * FROM” method for Sequel databases?

database,sqlite3,rubygems,sinatra,sequel

If you were doing this professionally, you'd split the app into layers. Inside the routes you'd be in the business or logic layer, and then you'd hand off data requests to the database layer. The database layer would likely be handled by and ORM (like Sequel, Datamapper, or ActiveRecord etc)...

Twitter Boostrap in Rails

ruby-on-rails,ruby-on-rails-3,ruby-on-rails-4,twitter-bootstrap-3,rubygems

I was able to work it out by moving my project into another directory, preferably into a different folder.

Can't convert html.erb's to haml with the “erb2haml” gem on Windows

ruby-on-rails,ruby,ruby-on-rails-4,rubygems,haml

I found a really easy and good way. First install the "haml-rails" gem if you haven't already, then just insert rake haml:erb2haml in the Console. It converts all .erb views into .haml . Works very fast and flawless. ~ Cheers...

Rails Heroku error of bundle?

ruby-on-rails,heroku,rubygems,bundler

You didn't run migration on production server. Run: heroku run bundle exec rake db:migrate ...

How do I compile a C program to use with my ruby gem via the C program's command line interface?

ruby-on-rails,c,ruby,gem,rubygems

This ended up being how I 'solved' the problem. A bit of a hack, but functional. https://github.com/NullVoxPopuli/kdiff3-rb/blob/master/ext/kdiff3/extconf.rb # Unconventional way of extconf-ing # http://yorickpeterse.com/articles/hacking-extconf-rb/ require 'mkmf' # Stops the installation process if one of these commands is not found in # $PATH. find_executable('make') find_executable('qmake') # create fake Makefile, courtesy of...

Formatting issue in ActiveAdmin dashboard

ruby-on-rails,ruby,rubygems,activeadmin

Here's a dirty fix for this, refactor as you wish: def root_house if meters && meters.pop && meters.pop.circuit meters.pop.circuit.root else 'object is not present' end end So I'm only going to call meters.pop.circuit.root if meters and meters.pop and meters.pop.ciruit is not nil. Google null object pattern and law of Demeter...

Trouble running RubyGems on Redhat 5.5

ruby,rubygems,redhat

RedHat 5 ships with Ruby 1.8.5 and an equally old rubygems. Both, the rubygems and the ruby version is WAY too old to be supported by anything outside the base packages of the OS anymore. Even in the OS packages, they probably won't change anything on their own due to...

Gem::RemoteFetcher::FetcherError::SSL_connect returned=1 erno=0 state=SSLw3

ruby-on-rails,error-handling,rubygems

Found a solution. gem source -r https://rubygems.org/ gem source -a http://rubygems.org/ Remove the secure URL, add an unsecure one. My gems are now updating without issues....

How to use gem 'geokit' to validate zipcode with respect to city and state in rails4?

ruby-on-rails,ruby,ruby-on-rails-4,rubygems

Here is what you need: require 'openssl' require 'geokit' geo = GeoKit::Geocoders::MultiGeocoder.multi_geocoder('90210') if geo.success geo.state # => CA geo.city # => Beverly Hills end Or you can use: A more lightweight option is the Area gem. require 'area' '11211'.to_region #=> "Brooklyn, NY" ...

How do I upload a gem to geminabox?

rubygems,geminabox

You have to upload a .gem file.

webdriver-user-agent gem classes not included in Rails model

ruby-on-rails,ruby,rubygems,watir-webdriver

You are trying to look for the module: WebDriver However, the webdriver-user-agent gem uses the module: Webdriver Notice the difference in the lowercase 'd'. Class and module names are case-sensitive, which is why the constant is not being found. The function should work by correcting the module name: class SomeModel...

Executable “require” can't find it's own library

ruby,gem,rubygems

Your gem should have a lib directory. During development, you will need to get that lib directory added to Ruby's load path one way or another. You can add it in Ruby code. I wouldn't recommend doing that in your situation, but it is helpful to put something like this...

capistrano regenerating wrappers error

ruby-on-rails,rubygems,bundler,capistrano3

Upgraded rake to v 10.4, added line set :bundle_flags, '--no-binstubs' to deploy.rb This fixed the problem!

Ruby roo gem: comparison of Fixnum with nil failed (ArgumentError)

ruby-on-rails,ruby,ruby-on-rails-4,rubygems

From looking at the code if seems that first_row will return nil if the default sheet (or the first sheet, if you did not assign a default sheet) does not have any non-empty lines. Check your file to see if maybe it is empty, or if the first sheet is...

how to customize the gem: pace-rails default option startOnPageLoad in rails 4

ruby-on-rails-4,rubygems

finally, I choose gem nprogress to show the progress bar, thank you

How to install a ruby gem

ruby,gem,rubygems,colorize

You can install the gem using your CLI simply by typing: gem install colorize. Then you can use them gem by requiring it, so at the top of your .rb file add require 'colorize'. Then just test it out by trying puts "This is blue".colorize(:blue). Your .rb could look like...

Can't install jekyll gem at linux (classifier-reborn ruby version error)

ruby,linux,rubygems,rvm,jekyll

I've found solution here I've reinstalled rvm and rubygems without sudo and then installed jekyll gem without sudo....

Install a gem locally for development

ruby-on-rails,ruby,gem,rubygems

If you want your Gemfile to use a local gem, use path like this: gem "swagger-docs", :path => "/Users/name/my_swagger_fork" If you want to use a git remote, you can do this: gem "swagger-docs", :git => "git://github.com/user/swagger.git", :branch => "my-awesome-branch" ...

How do you protect your API key in your tests when you publish a gem with tests?

ruby,rubygems

Broadly speaking, here are three approaches I have used in the past in similar situations. Which you choose will depend on the details your particular situation. Test user supplies API key If your test suite requires, or at least prefers, actual API calls with an actual API key, you can...

Rails rdoc Gem error/corruption issue

ruby,ruby-on-rails-4,rubygems,bundler

FYI - Seemed to be an issues with Bundler. Removed bundler and reinstalled and all seemingly ok.

Parsing a JSON string with multiple keys

ruby,json,rubygems

You've almost got it. "value" contains an array which is what you want to loop through. Each element of that array contains a name which is what you want to access. parsed["value"].each do |record| p record["name"] end ...

Rails 4: Not able to require Bootstrap

ruby-on-rails,twitter-bootstrap,rubygems,asset-pipeline

After looking over the versions of Bootstrap, I realized the tutorial is slightly older, so I switched from the defaulted bootstrap-sass which is version '~> 3.2.0' to ~> 3.1.1 and it works great. Apparently the latest version of bootstrap-sass does not support *= require bootstrap and rather uses the @import...