ruby

Starting an E-Business, need direction on choice of languages

I am considering starting an e-business, but I am undecided as to which language to choose to write the core of the website in. I would prefer to avoid the Microsoft route of ASP.NET and C# due the costs, and I also just prefer to develop on Linux :-) Basically, I was weighing up between using PHP or Ruby on Rails. Myself and my develo...

Where can I find advanced Ruby on Rails tutorials?

I'm working creating rails application and wondered where I can find good tutorials on how to work with rails. I used this blog that I thought was great in starting to learn rails: http://fairleads.blogspot.com/2007/12/rails-20-and-scaffolding-step-by-step.html I have just started working with rails and would like to learn more advanc...

While installing redbox plugin to rails why does it say Plugin not found ?

When I try to install redbox plugin although everything gets installed, a last line says plugin not found. Why is that ? script/plugin install http://svn2.cvsdude.com/craigambrose/plugins/redbox + ./README + ./Rakefile + ./images/redbox_spinner.gif + ./init.rb + ./install.rb + ./javascripts/redbox.js + ./lib/redbox.rb + ./lib/redbox_hel...

Ruby RSS/Atom processor that knows which items I have already processed in the feed

Is there a ruby class or project that processes RSS/Atom feeds and keeps a track of the items I have already processed. ...

Rails task: script/runner or rake?

For ad hoc Rails tasks we have a few implementation alternatives, chief among which would seem to be script/runner some_useful_thing and rake some:other_useful_thing Which option should I prefer? If there's a clear favourite then when, if ever, should I consider using the other? If never, then why would you suppose it's still prese...

Under what cirumstances would I need eruby if I'm just doing Ruby programming

As I understand it, eruby is like erb - it lets you stick ruby code into HTML. If someone is using Rails, more than likely they would use erb or Haml. But if I'm not using Rails, under what cirumstances would I need eruby if I'm just doing Ruby programming? I guess I don't understand why someone would need to be outputting HTML if th...

How can I format the value shown in a Rails edit field?

I would like to make editing form fields as user-friendly as possible. For example, for numeric values, I would like the field to be displayed with commas (like number_with_precision). This is easy enough on the display side, but what about editing? Is there a good way to do this? I am using the Rails FormBuilder. Upon investigation, I...

Rails: rake db:migrate *very* slow on Oracle

I'm using rails with the oracleenhanced adaptor to create a new interface for a legacy application. Database migrations work successfully, but take an incredibly long amount of time before rake finishes. The database changes happen pretty quickly (1 or 2 seconds), but the db/schema.db dump takes over an hour to complete. (See example mi...

Best way to create custom config options for my Rails app?

I need to create one config option for my Rails application. It can be the same for all environments. I found that if I set it in environment.rb, it's available in my views, which is exactly what I want... environment.rb AUDIOCAST_URI_FORMAT = http://blablalba/blabbitybla/yadda Works great. However, I'm a little uneasy. Is this a go...

Directory to store cached files in Rails?

I am generating some large files in my Rails application. Fortunately, they only need to be generated once. I would like to save these files to disk so that I don't have to generate them again. Which directory in my Rails application is the most appropriate place to put application generated files? Thanks! ...

RSpec and Open-URI how do I mock raise a SocketError/TimeoutError

I want to be able to spec out that when Open-Uri open() calls either timeout or raise an exception such as SocketError I am handling things as expected, however I'm having trouble with this. Here is my spec (for SocketError): @obj.should_receive(:open).with("some_url").and_raise(SocketError) And the part of my object where I'm using ...

Open source document approval system or framework?

We have a new for a fairly simple workflow system, specifically focused upon business documents. It essentially accepts different types of documents (purchase requests, invoices, etc) and routes them to different roles and flows based on variables attached to them (total dollar amount, etc). I'm open to either using an existing one or w...

Execute remainder of ruby block more than once.

I'm making a framework for specifying processes which may involve choices. I've got it working where each choice is an island. I'd prefer that subchoices 'fork' the parent choice, so that all options are properly considered. choose :one => lambda { choose [a, b] if a raise "Illegal" end }, :two => .... Currently...

Speeding up Ruby script startup in Windows or Cygwin

I've got a ruby script which takes about 30 seconds to startup. It takes that much because it tries to load all libraries and stuff. When I do "ruby.exe -v" it's instant. I don't want to touch the original ruby script, which is not written by me. What are the tricks to speed this process up? Can I precompile it? Can I precache al...

How to specify default values when loading files using yaml?

I saved a object of class Foo using foo.to_yaml. Now i added an instance variable to the Foo class with default value set to 0 in the initializer method. now when I try to load the object from yaml file the instance variable is set to nil. Is there some way in which I can set it to 0 if the the yaml file doesnt contain any value for th...

Why is keypress not called after clicking on native controls?

Shoes.app do keypress do |k| if k==:f1 alert("Foo bar") end end button "foo" end Pressing F1 causes the alert box to pop up but. Once i click the button "foo" i.e. if the focus changes to a native control in the app. the keypress events are no longer captured. any way to get around it? I am using windows xp. ...

Polymorphic has_many self-referential

Hello there, I am having trouble getting this to work. My problem is. I have A number of models (Article, Video, Photo) Now I am trying to create a related_to association, such that An article can have many other articles, videos and photos related to it. As can videos and photos. Heres what I have tried module ActsAsRelatable def...

Ruby win32ole - how to determine the OLE class type, whether the OLE class supports a method

I am using Ruby 1.8. Using the WIN32OLE module - 1) How do I determine the class name of an OLE object instance? 2) How can I tell whether an object instance supports a particular method? In an Outlook automation script, I am trying to delete the items in the 'Deleted Items' folder which are older than 21 days. For mail items, I want t...

Problem with non activerecord associations in factory girl

I just started to use factory girl to replace fixtures when I am testing. I am working on a twitter client and I am trying to use factory girl to create the twitter objects for testing. When I create them individually it is fine. But, if I try to associate them I get the error below. Factory.define :status, :class => Twitter::Status,...

Executing a Cygwin process from .NET ?

I'm trying to launch Cygwin version of ruby.exe from a .NET application, but I'm stuck. c:\>"c:\cygwin\bin\ruby.exe" c:\test\ruby.rb /usr/bin/ruby: no such file to load -- ubygems (LoadError) As you see Ruby can't locate libraries because it's looking some Linux style paths. Obviously when I run ruby.exe from .NET since it can't fin...