Does ruby provide a method to show the hierarchy calls?
That's all, i want to see what are the clases that inherits a fixed class. There is a method for this in RUBY? Aptana offers an option that shows this, but is there any method? Thanks ...
That's all, i want to see what are the clases that inherits a fixed class. There is a method for this in RUBY? Aptana offers an option that shows this, but is there any method? Thanks ...
I have what looks like multiple versions of rubygems installed on my machine, when i gem list i see all my gems, but when i go to run scripts, i get error messages like Missing these required gems: SystemTimer Is there any methodology I can follow to remove all versions of rubygems but one? Ideally i would like to be able to access ...
I have a route in my code that looks like this: map.app 'applications/:title_header', :controller => 'apps', :action => 'show' I also changed my show method in the controller to be like this: @app = App.find_by_title_header(params[:title_header]) If I type in applications/title things work fine. If I type in applications/1 (valid I...
I need to grab a string like "/html/body/a" i need to check the last portion, in this case "a" after the final "/" how can i do this ? how can i regex match for the last item after the final "/" ? ...
What's the fastest/one-liner way to remove duplicates in an array of objects, based on a specific key:value, or a result returned from a method? For instance, I have 20 XML Element nodes that are all the same name, but they have different "text" values, some of which are duplicates. I would like to remove the duplicates by saying "if e...
What is the fastest/shortest/one-liner (not possible :p) way to build a unique tree of elements from a tree where many of the elements are duplicated/missing in some nodes, given the tree has a defined set of nodes (which we'd use this algorithm to figure out so we don't have to manually do it). It could be XML/JSON(hash), or whatever. ...
i have a string like /root/children[2]/header[1]/something/some[4]/table/tr[1]/links/a/b and /root/children[2]/header[1]/something/some[4]/table/tr[2] how can i reproduce the string so that all the /\[\d+\]/ are removed except for the last /\[\d+\]/ ? so i should end up with . /root/children/header/something/some/table/tr[1]/lin...
I've written a little ruby script that lets me send emails by calling it along with some command line parameters. At the command line, this works: ruby.exe mail_it.rb fromaddr="[email protected]" tolist="[email protected]" But try as I may, I can't get it to work in Delphi 2007 for Win32. Here's the latest attempt: procedure TF...
hi all I have been trying to do this for ages and can seem to grasp it. hope someone can help ? i have a 'message' model that has many through 'distribute' relationship to a 'contact_detail' model. basically a message can have many contacts associated with it and a contact can have many messages. I can get this to work and save it ...
If I have my website logically split into accounts (eg. acme.mywebsite.com, xyz.mywebsite.com), how can I implement act-as-taggable-on-steroids and have the tags scoped by the current account ? To give little more details, if I am accessing acme I don't want to see tags from xyz subdomain. I have looked into act-as-taggable-on, but the...
I'm seeking the most concise way to do this Given the following Array: ['a','b','c'] how to get this: {'a'=> 1,'b'=> 2, 'c'=> 3} and [['a',1],['b',2],['c',3]] I have few solutions at mind, just want to see yours :) ...
In an ActiveRecord model, is it considered best practice/necessary to use validates_presence_of when also using validates_length_of? For example: class Company < ActiveRecord::Base validates_presence_of :name validates_length_of :name, :in => 5..30 end To me, it seems redundant. Having a length between 5 and 30 means that the a...
Hello there, is it possible to follow a link by it's class name instead of the id, text or title? Given I have (haha, cucumber insider he?) the following html code: <div id="some_information_container"> <a href="edit" class="edit_button">Translation here</a> </div> I do not want to match by text because I'd have to care about the ...
I did some stuff to have to_param return a perma-url so I'd have seo friendly links. Upon creation and update it will generate and return the perma-url in a to_param method that I put in the model. However this causing me some grief in other areas. I have a form that looks like this: <% @apps.each do |app| %> <% fields_for "[id][...
I'm creating an online bookmaker odds comparison site for soccer and I'm wondering how to calculate the best odds in Ruby/Rails. I have two models: fixture and odds Fixture has home and away teams, and odds model has bookmaker ID, home odds, draw odds and away odds. I have selections which just stores the selected fixtures/teams in th...
Hi, I am having a problem with Vlad on windows. After calling rake vlad:deploy I am getting the following: uninitialized constant Fcntl::F_SETFD After googling for a while I figured out that there is problem with open4 gem that is not suitable for Windows and I should use popen4 gem instead. I installed it but nothing has changed. Ho...
I have a controller with some non standard actions, like admin, moderate, etc. I tried using the hook before_admin it that didn't work. Is it possible to use these hooks for my custom actions? Sorry for the lack of clarity. Say I have something that I want to happen before saving..it's easy to just do a before_save :do_whatever inside t...
I have an application that uses the Paperclip plugin for image upload. Now that app should get deployed to an host(heroku) which has a read-only file system. Can I somehow tell paperclip to store the images in the database? ...
This is related to a question I asked here: http://stackoverflow.com/questions/1569651/thread-locking-in-ruby-use-of-soap4r-and-qt However it is particular to one part of that question and is supported by a simpler example. The test code is: require 'rubygems' require 'thread' require 'soap/rpc/standaloneserver' class SOAPServer < SO...
The following modify method somehow modifies the whole @x array instead of just simply generating another element to be pushed later. How come? def modify i, s t = @x[-1] t[i] = t[i] + s t end @x = [ [10, 12] ] @x << modify(0, 1) puts @x Edited The following code have done the trick. Still I wonder if its possible to get rid o...