ruby

How do you schedule a daily script run on Windows XP?

I wrote a script in Ruby. I'd like to run it every day at a certain time. How do you do that on a Windows XP system? I poked around on the machine and discovered the "scheduled tasks" control panel, but it doesn't seem to have anything to do with running scripts, as far as I can tell from the options offered by the "wizard". ...

Ruby on Rails: Confirmation Page for ActiveRecord Object Creation

Using Ruby on Rails I want a confirmation page before creating an ActiveRecord object. The user will see a preview of the item they are creating before submitting and the object being saved in the database A common pattern; User visits /entry/new User enters details and clicks submit User is redirected to /entry/confirm which display...

How ZenTest works in detecting file save?

I read some source code of ZenTest but didn't find where it is implemented. Could you give me give some clue? Thanks in advance. ...

How can I deploy a Perl/Python/Ruby script without installing an interpreter?

I want to write a piece of software which is essentially a regex data scrubber. I am going to take a contact list in CSV and remove all non-word characters and such from the person's name. This project has Perl written all over it but my client base is largely non-technical and installing Perl on Windows would not be worth it for them. ...

How Do I Install Ruby Shoes On x64 Linux?

Hi. I recently discovered Ruby Shoes, which sounds rather useful for a beginner like me. The only the problem is that my laptop is x64, while the only Linux package is i686. I tried it anyway and it didn't work for me, I kept getting an error. I didn't expect it to work, of course, but is there still a way to get Shoes on x64 Linux? Than...

Same partial on multiple views returning to whatever view it was called from

I'm currently re-using a partial on two different views. View A View B The partial belongs to Model A but has an association with Model B so it is applicable to Model B as well. It contains a form and when data is submitted, it always redirects the user to View A. However, when I submit the form from View B, I would like to...

How to round a time down to the nearest 15 minutes in Ruby?

Is there an easy way to round a Time down to the nearest 15 minutes? This is what I'm currently doing. Is there an easier way to do it? t = Time.new rounded_t = Time.local(t.year, t.month, t.day, t.hour, t.min/15*15) ...

Where can I find documentation on functions available in the Ruby Shoe GUI Toolkit?

Is there any documentation that discribes all the available functions and objects in shoe? update: 2008.01.21 I am looking for a list of all the methods that can be called against an animate object. For example I only figured out how to pause an animation using the toggle() method by reading source code from the shoebox (http://the-sh...

Does Shoes have a list view control?

I was taking a look at Shoes which seems like a very nice tool for quick GUI applications. The common elements/controls, however, don't seem to include the equivalent of a list/report view (e.g., ListView in Windows, NSTableView in OS X). Did I just miss this, or does it not (yet) exist? ...

Change the ruby process name in top

I would like to change the name of the ruby process that gets displayed in the linux/unix top command. I have tried the $0='miname' approach but it only works with the ps command and in top the process keeps getting displayed as "ruby" Thanks for any hints in advance. ...

in ruby, how can I know what module is defined as result of a 'load' or 'require'?

In ruby, if I do "require foo", is there a way to subsequently determine the name of the module or modules defined in foo.rb? For example, say I have a ruby file named foo.rb that looks like this: # foo.rb module MyModule def self.summary "this does something useful" end ... end In another script, after I do "requ...

acts_as_solr returns all rows in the database when using the model as search query

In our application we're using acts_as_solr for search. Everything seems to be running smoothly except for the fact that using the model name as the search query returns every single row in the table. For example, let's say we have a users table. We specify acts_as_solr in our model to search the fields first name, last name and hand...

Is it possible to define a block with optional arguments in Ruby?

I'm trying to dynamically define functions that call through to another function that takes an options parameter: class MyClass ["hour", "minute", "second"].each do |interval| define_method "get_#{interval}" do |args| some_helper(interval, args) end end def some_helper(interval, options={}) ...

Best way to integrate a Rails app with a slow webservice

I need to implement a web client in a Rails app. The existing web service is SOAP and can often take several seconds to respond to requests. Using SOAP4R, the requests block. Is it acceptable to call these blocking methods directly from a rails controller? If not, should the rails controller buffer up commands with a separate service ...

Is there a self contained Ruby (and Rails) solution that can be run from a flash drive?

In the near future, I may be teaching a Ruby programming class to undergraduates at an art college. It's a safe assumption that the students have little to no experience with programming. The class will be taught in a computer lab, but they don't have any administrative rights on the lab computers. Ideally, I'd like the students to be ...

railroad balking on application model & admin level controllers

I've just installed railroad and tried to run a couple simple example runs. I have an application model and controller that are causing it some heartburn. There is no real application table - the model is used to load (include) things like the authenication system. The controller sets up the helper_methods, etc. I also have many contro...

Anyone know what CMS is using 37signals to manage the site?

I need to build simple site "one big page" like 37signals product's pages, and I was thinking about this. Anyone have an idea? are they using Radiant or coding manually? ...

Rails domain-based caching

Rails caches (file cache) per default domain-based, but is there a way to disable this? My rails app can be reached via multiple domains and the content is all the same. I just don't want to have multiple cache files. (I know memcache is better, this is not part of the question) ...

interactive console for Ruby, PHP

How do you start the Interactive Console for ruby and php ...

NoMethodError when trying to invoke helper method from Rails controller

I'm getting a NoMethodError when trying to access a method defined in one of my helper modules from one of my controller classes. My Rails application uses the helper class method with the :all symbol as shown below: class ApplicationController < ActionController::Base helper :all . . end My understanding is that this should mak...