rubygems

Rouge gem not showing line breaks in formatted code?

别说谁变了你拦得住时间么 提交于 2019-12-13 03:26:55
问题 I have followed minimal examples using the rouge gem here (i.e. the documentation), as well as here and here. Everything working, except that line breaks in the code aren't appearing. To be explicit, code like this def plus_two(x) x + 2 end has the colours highlighted correctly, but is rendered across one line, like so def plus_two(x) x + 2 end How can I make it render with the line breaks (just as in the code file) 回答1: Change require 'rouge' source = "def plus_two(x)\n x + 2\nend" formatter

Nested Set Error undefined method `self_and_descendants' for #<ActiveRecord::Relation:0x52c4a30>

强颜欢笑 提交于 2019-12-13 03:22:47
问题 I am using the Nested_Set gem in my code to sort Categories, Subcategories, and Products. I am trying to limit the depth/level of my nested set to no deeper then 2. Currently I am getting the error Nested Set Error undefined method `self_and_descendants' for #<ActiveRecord::Relation:0x52c4a30> I am trying to create a restraunt menu type style, and am going to attempt to make it drag and drop sortable. Here is my code: Can someone browse it and help me understand this error? Thanks Category.rb

How do you develop multiple gems?

筅森魡賤 提交于 2019-12-13 03:18:25
问题 I'm developing two gem: Runel and Runic. Runel depends on Runic. But then how do I get Runic to load up to run Runel tests (and bundle install). I need Runic in the Runel tests because some of Runel's classes extend from Runic's classes. And I want to test it (try it out) as the whole thing (Runel is a VM, Runic is the base for it). 回答1: If Runel depends on Runic, then the tests of Runic should use Runel. That is, Runic provides a service and this service should be tested as an independent

How to update rails 2.3.10 to 3.x

最后都变了- 提交于 2019-12-13 02:10:00
问题 Currently I am using rails 2.3.10, I want to update my rails version to version 3. What's the command to update rails? 回答1: So, the basic command would be: gem update rails But, upgrading from 2.3.x to 3.x isn't a trivial task... you should really read up a little more on it before you do so. 回答2: Ryan Bates shows you how to do it here. The Rails version you are using are completely different so you will have to upgrade Rails and then use this plugin to help upgrade your application unless

Installing mysql ruby gem in windows fails using ruby 2.0.0

[亡魂溺海] 提交于 2019-12-13 02:07:56
问题 Using chocolately I have installed ruby and ruby.devkit cinst ruby cinst ruby.devkit I then followed the instructions on the github wiki and tested the devkit as so detailed in point 5 gem install json --platform=ruby ruby -rubygems -e "require 'json'; puts JSON.load('[42]').inspect" This worked ok so I assume my devkit installation was correct. However when I try to install mysql gem like so gem install mysql --platform=ruby -- --with-mysql-dir=C:/mysql-connector-c-noinstall-6.0.2-win32 I

Rails traverse hash from API XML response

风流意气都作罢 提交于 2019-12-13 02:01:19
问题 I have this hash that I received from an API, using Httparty. The response was an XML but httparty showed it as a hash. But it is soo deep, it gets confusing to get the values. {" air_search_result "=>{"xmlns"=>"http://www.cleartrip.com/air/", " onward_solutions "=>{" solution "=>[{"index"=>"1", " pricing_summary "=>{"base_fare"=>"3350.0", "taxes"=>"7828.55", "total_fare"=>"11178.55"}, " flights "=>{" flight "=>{" segments "=>{" segment "=>[{"index"=>"1", "departure_airport"=>"BOM", "arrival

mysql gem looking for an earlier version of libmysqlclient.16.dylib

廉价感情. 提交于 2019-12-13 01:43:12
问题 I just upgraded to Mac OSX Snow Leopard, and recompiled mysql (5.1.39) with the Snow Leopard XCode. I also reinstalled the latest mysql gem. Now, when running rake db:migrate in a rails app, I get dyld: NSLinkModule() error dyld: Library not loaded: /usr/local/mysql/lib/libmysqlclient.15.dylib Referenced from: /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle Reason: image not found Trace/BPT trap I have /usr/local/mysql/lib/libmysqlclient.16.dylib, but not ...15.dylib. Do I need

GitLab on Wheezy, error while installing Gems, libmysqlclient-dev probably missing but unistallable

一世执手 提交于 2019-12-13 01:27:12
问题 So, while I was installing GitLab following the official tutorial I got an error on the Gems installation. Gem files will remain installed in /home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/mysql2-0.3.11 for inspection. Results logged to /home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/mysql2-0.3.11/ext/mysql2/gem_make.out An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling. Looking online they

Bundle failing on JRuby with “TypeError: can't convert Regexp into String”

时光毁灭记忆、已成空白 提交于 2019-12-13 01:20:05
问题 I've deployed a new server that has the exact same version of JRuby (1.7.22), Java (openjdk-7-jre-headless 7u51), and bundler as the other servers. Both servers are running Ubuntu 14.04, but the new one has some newer packages. I deployed the same version of the project using Capistrano to the new server. When Capistrano runs bundle (or when I do it myself), the following error and callstack are presented: TypeError: can't convert Regexp into String end_with? at org/jruby/RubyString.java:5281