ruby

IronRuby vs. regular Ruby, to develop Rails apps on Windows

For non-Rails work, regular Ruby works fine on my Windows 7 machine. But I'm about to start some Rails work that will use SQL Server as a database, and trying to get Rails set up has been a total pain so far. (I still can't get sqlite3 or SQL Server to work correctly with Rails yet.) So I'm wondering: will using IronRuby (which I haven...

will "gem update --system" update rails from 2.3.8 to 3.0?

If'n I had a 2nd computer I would just do it and see - but I've finely tuned this thing to not run 3.0 just yet ... don't want to muck it up. Took hours & hours to get here. Bascially - I want to keep rails at 2.3.8 for a while ... so will gem update --system update rails from version 2 -> 3? I did read the docs with no clear answe...

Chef and application deploy

How is it possible to keep my rails application up to date using chef? While reading documentation I understood how to set up servers from scratch using knife bootstrap. But is it possible to run another tasks after this? Earlier I have used capistrano but now we have two staging and ten production servers which needs to be up to date ...

Ruby can only show local time and Greenwich Mean Time (UTC) but not East Coast Time or Central Time?

$ irb ruby-1.9.2-p0 > RUBY_DESCRIPTION => "ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]" ruby-1.9.2-p0 > Time.now => 2010-09-07 18:18:38 -0700 ruby-1.9.2-p0 > Time.now.gmtime => 2010-09-08 01:18:43 UTC ruby-1.9.2-p0 > Time.now.strftime('%H:%M %Z') => "18:22 PDT" ruby-1.9.2-p0 > Time.now.gmtime.strftime('%H:%...

How does Google Scribe work?

I'm asking about the new labs feature "Google Scribe." Here is the link: http://scribe.googlelabs.com/ I am interested in the backend and the frontend, but mainly the backend. I want to build something similar with a very specific data set (derived from my own documents). I think the frontend of it is fairly straightforward, and I co...

Extract url from text

How to extract all urls from a text in ruby? I tried some libs but it fails in some cases, whats the best way? ...

Accessing object values that have reserved keywords as names in Rails

Hi, I'm accessing the Amazon AWS API using the ruby-aaws gem, but without going to much into details of the API or the gem, I think my problem is more of a general nature. When I query the API I will end up with "object array", let's call it item, containing the API response. I can easily access the data in the array, e.g. puts item.it...

Rack and Scrapi problems on Heroku

I am trying to deploy an app on Heroku, however the app crashes and I get this when I run heroku logs (full trace below; Gemfile content below). You have already activated rack 1.2.1, but your Gemfile requires rack 1.0.1 I am using bundler (1.0.0.rc.6) for the gem management. I also have a Scrapi problem, it requires a Mac lib even th...

How is Ruby more object-oriented than Python?

Matz, who invented Ruby, said that he designed the language to be more object-oriented than Python. How is Ruby more object-oriented than Python? ...

What is the :: sign/operator before the class name in ruby?

Hi, in ruby, :: namespaces the module and class. But I often see :: at the beginning of the class name like the following: #snippet of gollum gem def page_class @page_class || if superclass.respond_to?(:page_class) superclass.page_class else ::Gollum::Page end end What does that :: stands for if its in the be...

link_to_remote and link_to in Rails 3

Hi, I'm a newbie spanish Rails developer. ¿Can u help me with a problem with Rails? I have an application with RoR 2 and Google maps and i catch X and Y coord to send to a controller. I use :with parameter <%= link_to_remote "Obtener datos catastrales", :update => :catastro,:url => {:controller => "instalacions", :action => "catastro_...

incompatible character encodings: UTF-8 and ASCII-8BIT Ruby 1.9

Hi, I have just recently upgraded to ruby 1.92 and one of my monkey patches is failing with some sort of encoding error. I have the following function: def strip_noise() return if (!self) || (self.size == 0) self.delete(160.chr+194.chr).gsub(/[,]/, "").strip end That now gives me the following error: incompatible ch...

How do you precompile the native extensions for a ruby gem for linux?

We have a ruby application that depends on a gem with native extensions (in this specific case Nokogiri). However, for various reasons we cannot install the build prerequisites (such as build-essential, libxslt-dev, ruby-dev, etc) for that gem onto our production host. Is there a (standard?) way to repackage the gem with the native exte...

Ruby / Rails - A better way of running post-deploy tasks?

We're hosting our Ruby on Rails application with the EngineYard App Cloud, which has worked really well for us. They provide a series of deploy call backs (before_restart, after_restart, etc.) which are analogous to Capistrano's callbacks. We have a series of Rake tasks within our application which maintain various parts of the applica...

Calculate percentage in ruby ??

Is there any method available to calculate percentage in rails or ruby ?? EDIT: I am looking for a function like .. 100000.percent(10) will return me 10000. 100000 is value ..(value is BigDecimal) 10 % .. result = 100000 * 10 / 100 result = 10000 .. ...

Testing against the 'current_user' with Devise in Rails 3

I'm just starting out with Ruby and Rails, trying out Devise with Rails 3. I've got a loop around a list of Posts, each of which has an associated user. I only want to display editing controls for those posts which are associated with the current user. <% @posts.each do |post| %> <%= link_to "show" %> <% if current_user = post.user ...

ActiveRecord to use mysql named pipes on windows

Hi Is it possible to connect from ruby/ActiveRecord to a mysql database over named pipes. OS is Windows. Thanks. ...

Passenger with Nginx cannot find rails 2.3.8 gem

I have been trying to setup nginx with passenger for a few days now and keep running into problems. When I go to my Rails application with my browser it says: Missing the Rails 2.3.8 gem. Please gem install -v=2.3.8 rails, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comme...

What is the purpose of Rake?

I know Rake stands for Ruby Make, and I know Make is a unix build utility. Now, I come from working in Xcode building iPhone apps to Ruby, so I have never used Make before, and the only time I use rake is when in rails or installing some third party package and I type a command like rake db:migrate. The things I don't understand are ... ...

LoadError when using heroku db:push

When i use "heroku db:push" to transfer my local data to heroku,i got this error message: Sequel::AdapterNotFound -> LoadError: no such file to load -- sequel/adapters/mysql2 I already install the mysql2 gem, and i am using rvm with ruby 1.9.2 in Mac OS X Snow Leopard. ...