rubygems

Example for using diff ruby gem to find difference between two files

一曲冷凌霜 提交于 2019-12-08 04:54:59
问题 Can someone give me an example to find the difference between two text files in Ruby. I am not able to figure out how to use the diff ruby gem. Also it would be great to know how to apply the diff output on the original file and get the latest file. I tried looking at the documentation for patchr gem but there was nothing available. 回答1: I suggest that you try diffy instead. 来源: https://stackoverflow.com/questions/4925127/example-for-using-diff-ruby-gem-to-find-difference-between-two-files

Extend a rails model in a gem

六月ゝ 毕业季﹏ 提交于 2019-12-08 04:54:56
问题 I wanted to extend a model call Configuration defined in my rails app. For some architectural reason, it will be great if i can extend it in a gem. But in my gem foo.rb file if i call my configuration class: Configuration.class_eval do ... end It return me this error: configuration: undefined method 'config' for nil:NilClass (NoMethodError) And if i tried this : class Configuration TEST = [:foo, :foo2].freeze end I cannot access anymore to my activerecord class defined in my rails app. Is

Ruby on Rails - rails server exits immediately after starting (SystemStackError)

对着背影说爱祢 提交于 2019-12-08 04:45:10
问题 I have set up Ruby on Rails using Windows 10 bash in C drive. I've used rbenv to set it up and updated my ruby version to 2.4.0. Then, I updated the rails version to 4.2.6 and ran bundle update to update my gem, and I ran rails server, but it's not starting the server. Instead, it exits the server immediately and it shows me the following error: /home/yschang/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thread_safe-0.3.5/lib/thread_safe/cache.rb:155: warning: constant ::Fixnum is deprecated

Is passing multiple params to thinking_sphinx search method absolutely impossible?

非 Y 不嫁゛ 提交于 2019-12-08 04:23:39
问题 I have a page that when visted brings up the most recently active users. Above the users are some filtering options such as filtering by one or a combination of: location gender sexual preference age range country I'm using a form_tag helper for my form. My issue is passing each of these parameters to my controller: class BrowsersController < ApplicationController def index @default_image = "/assets/default_avatar.jpg" @users = Profile.search params[:search], :page => params[:page], :per_page

Windows 10 64-bit: ERROR: Could not find a valid gem 'compass' (>= 0), here is why:

隐身守侯 提交于 2019-12-08 03:55:07
问题 I'm trying to install ruby in windows 10. For install compass & SASS but I'm unable to install this I tried all the things I know it & as per various question answer from various website including stack overflow. set SSL_CERT_FILE=C:\RailsInstaller\cacert.pem or set SSL_CERT_FILE= curl.haxx.se/ca/cacert.pem gem install compass Received Following Error Message: ERROR: Could not find a valid gem 'compass' (>= 0), here is why: Unable to download data from https://rubygems.org/ - SSL_connect

Rubygem God: Time limit configuration for process

断了今生、忘了曾经 提交于 2019-12-08 03:20:41
问题 I am using resque, resque-scheduler gems in my rails app. To monitor the working of resque workers, I am using God tool. I want to add such a god configuration, which will monitor the time of job running in the resque worker. If process execution exceeds the time limit, then it should restart the worker. I read post at http://god.rubyforge.org/. However, couldn't peek the right code base for my requirement. Any information will be highly appreciated. Thanks. 回答1: You could do something where

bcrypt-ruby won't install with bundler but works fine with gem install

给你一囗甜甜゛ 提交于 2019-12-08 02:16:57
问题 I just recently began having trouble with bundler - bcrypt-ruby will not install when doing a bundle install or sudo bundle install and exits with the following error: Installing bcrypt-ruby (2.1.4) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /usr/bin/ruby1.8 extconf.rb Gem files will remain installed in /home/deploy/vendor/bundle/ruby/1.8/gems/bcrypt-ruby-2.1.4 for inspection. Results logged to /home/deploy/vendor/bundle/ruby/1.8

can't run sass after successfully installing it

…衆ロ難τιáo~ 提交于 2019-12-08 02:15:58
问题 I did sudo gem install sass , which succeeded. Running sudo sass -v works fine, but running as a normal user gives: $ sass -v -bash: /usr/bin/sass: Permission denied Indeed the executable's permissions are 700. I changed the permissions to 755, but that leads to: $ sass -v /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'sass' (>= 0) among 4 total gem(s) (Gem::LoadError) from /System/Library/Frameworks/Ruby

Huge json object to excel?

主宰稳场 提交于 2019-12-08 01:56:53
问题 I have a PHP application which has a table with more then 10000 rows and I am trying to export that into an excel sheet via my ROR application but my request is getting timed out on the server by PHP application.So I was wondering is there any elegant way to solve this problem. I come up with 2 solutions. First is doing a batch processing (need to read about as I am new with it) and the other is that my php application will send a large json object and my ruby app will read that json object

Can I have/use different Versions of rails in the same machine

让人想犯罪 __ 提交于 2019-12-08 01:34:18
问题 I am actually reading a rails book that is written for rails 2.3.5. I want to test Rails 3 beta as well. Is it possible to have such a setup in my Mac OS leopard? I have tried with gem list -d rails. There are many versions stored in my mac but I don't know how to use different versions of rails while creating applications using rails command 回答1: While RVM is great there's no need for it in this use-case. Install the Rails 3 gem: gem install rails—pre Create new project: rails project_name