ruby

Is it possible to determine whether an ActiveRecord attribute has been set, other than to the default?

We have an ActiveRecord model whose columns have some default values. It also has a validation condition such that, if the 'profile' property is set to a different value, then the default values are invalid. What I'd like is to be able to determine whether the attributes have been set since they were set to the default so that I can re...

Confusion about delayed_job startup.

I have script with that i can install everything on server. I don't need to monitor my jobs. Is it a proper way if i will add this two lines on my that script to start delayed_job server on my production server. chmod a+x script/delayed_job RAILS_ENV=production script/delayed_job start Because we have a product and we can't monitor it...

Implement an existing scripting language for a dynamic OO program

Hi, I am working on a program, which handles a lot of objects and data. As I would be able to inject manipulations by having some kind of 'API' to my application. As the application itself does the management of the objects and such, I wonder how this can be implemented. For example, the Unity3D and Panda3D engines allow a variety of la...

fetch start and end time for every job with delayed_job.

Is there any way i can fetch start and time for my every job. I am using delayed_job. ...

Quickest language to make a little 'Connect to a SSL webpage' script

Hi! I just need some advice. I already know how to play with bash, ruby, python and perl and I'd like to know: with which of them would it be faster to make a little script that would connect to a website with SSL and login. I just need to do this script and make a cron job with it. So it must be executable from the console. Thanks. ...

ActiveResource error handling

Hi. I have been searching for a while and yet I am not able to find a satisfactory answer as yet. I have two apps. FrontApp and BackApp. FrontApp has an active-resource which mimics a model in BackApp. All the model level validations live in BackApp and I need to handle those BackApp validations in FrontApp. I have following active-res...

How to get the particular part of string matching regexp in Ruby?

I've got a string Unnecessary:12357927251data and I need to select all data after colon and numbers. I will do it using Regexp. string.scan(/:\d+.+$/) This will give me :12357927251data, but can I select only needed information .+ (data)? ...

Rails plugin for User reg, password recovery, the works?

Is there such a plugin for rails that will do everything for user registrations, or must this all be coded from the ground up using various plugins and combining them or just coding some parts by hand? ...

The framework spawner server exited unexpectedly

I'm having problems with my RoR application. Suddenly, after no changes or anything, I started getting the The framework spawner server exited unexpectedly exception. I've tried searching for some information, but everything leads to dead end. I had the app running for about half a year with no problems, but I suddenly got this error. ...

No response to Show and Rails Routes

I have my file structure set up appropriately ( I think ! ) , and claims nothing responds to show. My file structure : views/admin/admin_wysi/index.html.haml My controller ( controllers/admin/admin_wysis_controller.rb ) class Admin::AdminWysisController < Admin::ApplicationController def index end end My routes.rb map.name...

monit with delayed_job.

if my delayed_job server broke than monit will automatically restart the delayed_job server again or not? ...

Ruby - How to unpack a binary string into a normal string?

I'm opening a CSV file and reading values from it using File.open(filename). So I do something like this: my_file = File.open(filename) my_file.each_line do |line| line_array = line.split("\t") ratio = line_array[1] puts "#{ratio}" puts ratio.isutf8? end The issue I'm having is the values in line_array seem to be in a strange for...

Ruby/Watir - Formatting print from an array

I'm using Watir to do some automated testing for a website. This particular test I'm pulling an array of sku numbers from an Excel sheet and then randomly selecting one from the array to use as my test. The number is placed into a search field and it pulls back my product. Here's my problem: I'm pulling the data from Excel and I pri...

Reducing the depth of a Hash object

I have a hash object from an ActiveRecord. I'm going to be calling to_json on it, but I am looking to reduce the depth of the object that is being returned. Here is what my find looks like: @tags = Tag.find_all_by_type("some_type", :select => :name) The result of @tags.to_json looks like this: [{"tag": {"name": "some tag name"}}, ...

Sinatra, progress bar in upload form

Hi! I'm developing a Sinatra app that consists of an upload form, with a progress bar indicating how much of the upload has completed. The process, as described by ryan dahl, is the following: HTTP upload progress bars are rather obfuscated- they typically involve a process running on the server keeping track of the size of the te...

What is the best components stack for building distributed log aggregator (like Splunk)?

I'm trying to find the best components I could use to build something similar to Splunk in order to aggregate logs from a big number of servers in computing grid. Also it should be distributed because I have gigs of logs everyday and no single machine will be able to store logs. I'm particularly interested in something that will work wi...

Faster/more efficient alternatives to Ruby's Marshal?

I'm looking for a drop-in replacement of Ruby's Marshal capability, which hopefully has one or more of the following advantages over Marshal: faster serialization/deserialization more concise (or simply smaller) object-graph Thanks!! ...

Ruby on Rails request to not returning & no info in log

When you execute an action on my application (only one action) the browser will just sit there not doing anything, when i check my production.log i see the request (about 2 minutes after i go to the address) but i see no errors or problems, while the browser never stops "Loading". I checked my NGINX server logs, and didn't find anything,...

Deleted files not being removed from HDD in Ruby

I'm experiencing a weird situation with deleting files in Ruby, the code seems to report correctly, but the physical file isn't removed from my hard drive. I can do rm path/to/file on the command line - that works. I can even open up the Rails console and File.safe_unlink the file and that also works, it's just within my Rails app it fai...

How should I split up large unit tests in ruby?

I'm writing some unit tests for one of my rails models. It's a large model and in some cases I have dozens of assertions for many of the methods. I prefer using plain test/unit with rails' activesupport syntax so I have a file like this: require 'test_helper' class ItemTest < ActiveSupport::TestCase test "for_sale? should be true if c...