rubygems

skip carrierwave Integirty and Processing validation

依然范特西╮ 提交于 2019-12-12 15:24:00
问题 I have white listed some of the extensions in the carrierwave uploader class def extension_white_list %w(doc docx) end In some cases I would like to skip the Integrity validation while saving a record. But as per their documentation validates_integrity_of validation exist by default. https://github.com/carrierwaveuploader/carrierwave/wiki/How-to%3A-Validate-uploads-with-Active-Record can anyone please tell me how to skip such validation ? 回答1: in uploaders/file_uploader.rb def extension_white

Using multiple Bundler versions

萝らか妹 提交于 2019-12-12 13:32:02
问题 I've joined a project which is using bundler version 1.17.1 . Currently my system is using bundler 2.0.2 . Is there any way for me to specify a bundler version just like specifying ruby version with rbenv . Something likes: bundler --global 1.17.1 So that, when I run the command bundler -v I will receive the result 1.71.1 rather than 2.0.2 I tried to uninstall the current bundler with gem uninstall bundler and received this message: $ gem uninstall bundler Select gem to uninstall: 1. bundler

Avoiding mirrors to install a freshly released gem

独自空忆成欢 提交于 2019-12-12 12:26:02
问题 Bundler 1.3.0 has just been released (only 10 people have installed it so far), but I can only install a pre version, or a previous version. $ gem install bundler --version 1.3.0 --verbose HEAD http://rubygems.org/specs.4.8.gz 302 Moved Temporarily HEAD http://production.s3.rubygems.org/specs.4.8.gz 304 Not Modified ERROR: Could not find a valid gem 'bundler' (= 1.3.0) in any repository HEAD http://rubygems.org/prerelease_specs.4.8.gz 302 Moved Temporarily HEAD http://production.s3.rubygems

Getting the executed command from FileUtils?

我是研究僧i 提交于 2019-12-12 12:12:20
问题 When you pass the :verbose flag to a FileUtils command, the command gets printed to STDOUT. Is there a way to capture the command so it can be logged or used elsewhere? 回答1: If you look at the source for FileUtils it uses the following method for doing its verbose output: def fu_output_message(msg) #:nodoc: @fileutils_output ||= $stderr @fileutils_label ||= '' @fileutils_output.puts @fileutils_label + msg end i.e. it is writing the messages to @fileutils_output and by default it is using

Why doesn't nokogiri install?

倾然丶 夕夏残阳落幕 提交于 2019-12-12 10:13:37
问题 I'm having a devil of a time installing Nokogiri on Ubuntu 12.04. I use rbenv. $ gem install nokogiri -v '1.6.1' ERROR: While executing gem ... (Errno::EACCES) Permission denied - /home/deploy/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.1/.autotest $ sudo gem install nokogiri -v '1.6.1' ERROR: Error installing nokogiri: nokogiri requires Ruby version >= 1.9.2. $ rbenv sudo gem install nokogiri -v '1.6.1' Building native extensions. This could take a while... ERROR: Error

ruby: code to install gem if missing

本秂侑毒 提交于 2019-12-12 09:39:43
问题 is there some ruby code I can use to install a gem from a local file, if that gem is not installed? i'm thinking it would look something like: if !gem_installed("some gem name") system "gem install -l local_copy.gem" end i don't know if anything exists that lets me check for gems like this or not... 回答1: Checking availability is covered in this previous StackOverflow Quesiton begin gem "somegem" # with requirements gem "somegem", ">=2.0" rescue Gem::LoadError # not installed end or matches =

How can I profile a Rails app in its entirety, not just controllers? [duplicate]

荒凉一梦 提交于 2019-12-12 09:09:44
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: What tools do you recommend to profile Rails apps? My rails app is taking ~2 seconds to respond to POST requests, and I can't figure out why. When I use traditional profiling tools like newrelic or things that hook into unit tests, they tell me that all of my requests are fast, taking under 20 ms. But when I actually time the requests, they are taking 2 seconds. GET requests are fast. This happens in both

Having difficulty installing ruby-filemagic gem on new RHEL6 server

荒凉一梦 提交于 2019-12-12 08:23:24
问题 It appears to be looking for the libmagic.so.1 file. I have that file. It is located in /usr/lib64. I am not running this installation as the root user. I am also using rvm and Bundler. This is the result of my "bundle" command, when it gets to the ruby-filemagic line in my Gemfile: [server@mine ext]$ ruby extconf.rb --with-magiclib checking for magic_open() in -ltrue... no *** ERROR: missing required library to compile this module *** extconf.rb failed *** Could not create Makefile due to

How to make a specific gem version as default?

有些话、适合烂在心里 提交于 2019-12-12 08:18:36
问题 I have two versions of ruby gem. json (default: 2.0.2, 1.8.6) Here, the latest version is set to default; however I need json 1.8.6 to be set as default. Is there anyway to make the older versions of the gem as default? cos I am unable to uninstall the default json version. Need a switch between available gem versions. 回答1: Check what you have with: gem list json Set the one you want: gem install --default -v1.8.6 json This is most useful for things like "bundler"!!! For other things, using

How to integrate elasticsearch with rails application specifically using “Elasticsearch” gem

邮差的信 提交于 2019-12-12 07:49:39
问题 I am new to rails and as well to elastic search. I have seen other resources to configure using Tire, Searchkick and some others, but I want to use Elasticsearch gem. I have running rails application and running Elasticsearch server on my system but I do not how to configure them to communicate with each other. Currently, I am facing a lot of troubles to do the same. Any help would be highly appreciated. 回答1: For a very basic quick start of the elastic's github gem for model indexing you