ruby

RoR: Listing of subrecords

Schema: persons (id, name, birthyear, gender) pets (id, person_id, name, leg_count) plants (id, person_id, kind, qty) I would like to make a read-only report about these things grouped by persons. The listing of personns is done (without the associated records). I would like to have "subtables" per persons. Something like: Persons +...

Handling unicode data in XMLRPC

I have to migrate data to OpenERP through XMLRPC by using TerminatOOOR. I send a name with value "Rotule right Aurélia". In Python the name with be encoded with value : 'Rotule right Aur\xc3\xa9lia ' But in TerminatOOOR (xmlrpc client) the data is encoded with value 'Rotule middle Aur\357\277\275lia' So in the server side, the data value...

Problem with Rails 3.0.0 and Ruby 1.8.7? Sporadic 'wrong number of arguments' error

I'm using Rails 3.0.0.rc with Ruby 1.8.7 on Snow Leopard. I was using Builder to to restrict what's returned by render :xml for a User model object. It wasn't working as expected, so I commented out my format.xml block. E.g., this was my users_controller.rb: def create # TODO: Limit the frequency at which this can be called. ...

Factory_girl or machinist?

Are you using factory_girl or machinist for stubbing/mocking in Rails tests? ...

i18n assets management / translation UI

Hello everyone, i'm building a multi-lingual webapp with i18n from the ground up, and while i myself can deal with an army of yml files, the languages i speak are ( very ) limited, and would eventually like to ask for outside help. I'd like to know if anyone here is using a UI plugin/gem ( not unlike django-rosetta on django ) to deal ...

Open a file case-insensitively in Ruby under Linux

Is there a way to open a file case-insensitively in Ruby under Linux? For example, given the string foo.txt, can I open the file FOO.txt? One possible way would be reading all the filenames in the directory and manually search the list for the required file, but I'm looking for a more direct method. ...

Write a script to do content filtering with postfix

How can i write in python or ruby a script to do content filtering in postfix via smtp or uucp (not pipe)? There is some examples? ...

All Ruby interpreters follow the same Ruby syntax?

Do all Ruby interpreters follow the same Ruby syntax defined in www.ruby-lang.org? MRI YARV Rubinius JRuby IronRuby Cause it is the interpreter that defines the Ruby language. Does that mean one interpreter could add a feature/syntatic sugar that other interpreters haven't? If that is the case, do all interpreters have their own API...

Need advice on MongoDB Schema for Chat App. Embedded vs Related Documents

I'm starting a MongoDB project just for kicks and as a chance to learn MongoDB/NoSQL schemas. It'll be a live chat app and the stack includes: Rails 3, Ruby 1.9.2, Devise, Mongoid/MongoDB, CarrierWave, Redis, JQuery. I'll be handling the live chat polling/message queueing separately. Not sure how yet, either Node.js, APE or custom Eve...

Question about IO.popen

How to write and read from process with Ruby? I wrote this, but it didn`t work... output = IO.popen("irb", "r+") do |pipe| pipe.gets pipe.puts "10**6" pipe.gets pipe.puts "quit" end I rewrite so IO.popen("irb", "w+") do |pipe| 3.times {puts pipe.gets} # startup noise pipe.puts "10**6\n" puts pipe.gets # I expect " => ...

Can't find OpenSSL headers/libs when installing Ruby1.9 from source

I'm trying to install Ruby 1.9 from source, and I can't seem to get it to figure out where the OpenSSL headers and libraries are located. ruby-1.9.2/ext/openssl/extconf.rb says it can't find openssl/ssl.h -- which I've very definitely installed in ~/.local/include (the corresponding OpenSSL library is in ~/.local/lib). How can I tell Ru...

Rubygems. LoadError in Rails

Hi. Everytime I start my Rails applications I get LoadError with the following output. On Rails 2.3.8: no such file to load -- sqlite3/sqlite3_native <internal:lib/rubygems/custom_require>:29:in `require' On Rails 3.0.0: no such file to load -- bundler <internal:lib/rubygems/custom_require>:29:in `require' I run the application...

Ruby Shoes: Minimize app to system tray on windows

Does anyone know if it is possible (and if it is, how?) to put a Shoes application in MS Windows system tray? Something like using minimize to put the window to system tray. ...

Installing Compass

Once again, having trouble installing Compass, like here only different. My versions and error: $ cat /etc/issue Ubuntu 10.04.1 LTS \n \l $ ruby -v ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux] $ compass -v Compass 0.8.17 [2465bab] Copyright (c) 2008-2009 Chris Eppstein Released under the MIT License. $ haml -v Haml/Sass 3.0.18 (...

Sorting model instaces with Globalize3

The problem seems trivial, but I can't find any resonable solution. I have list of countries with translations stored in Globalize3 translation tables. How can I fetch the list of countries sorted by name? Country name isn't stored directly in the model, but in separate table. Is there any resonable way to sort the result other than ma...

ruby HttpClient library closing socket after response with persistent connection?

Hi chaps, I'm using the HTTPClient gem (http://github.com/nahi/httpclient) for ruby, to post data to IIS 6.1. Even though both support HTTP 1.1 it seems to be closing the socket after each request made, rather than using persistent connections. I haven't added any flags to enable persistent connections (mainly because having poked about ...

How can I include rails code inside a validation message?

validates_presence_of :match, :message => "for your name and password could not be found. Did you #{link_to "forget your password", help_person_path}?" That's what I want to do. I can interpolate variables that are set in the model, but using simple Rails code like "link_to" doesn't seem to work. Which is a bummer. ...

Ruby interpreter 1.8.7.0 [i386-mingw32] keeps failing

I have had this problem for a while, but now it is getting so bad that every 2-3 pageloads my local server is failing. activesupport-2.3.5/lib/active_support/core_ext/module/introspection.rb:73: [BUG] gc_sweep(): unknown data type 0x0(0x950f868) ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32] This application has requested the ...

Ruby: How to demonize MailMan (incoming mail processing microframework)

I'm using mailman gem for fetching email from pop3 server and send it to Rails application. What should I do to make mailman be as daemon? Please, tell me easiest way to do it. May be whenever gem can help? Something like: every :reboot do command "cd /home/rails/root && ruby bin/mailman_fetcher.rb" end ...

How to use Scrubty properly to grab URL from the XML outputted content

I am by no means a master with Ruby and am quite new to Scrubyt. I was just trying out some examples found on there wiki page. The example i was working on was getting the search results returned by Google when you search for 'ruby' and I had the idea of grabbing the URL of each result so I could go ahead and fetch that page as well. The...