Guruza search results for ruby http://guruza.com/searches/show/2 Questions recently submitted to Guruza that match the query: ruby Tue, 08 Jul 2008 18:52:42 -0700 $0.00 - delete http://guruza.com/question/567/reward-0.00 delete Tue, 11 Mar 2008 15:27:01 -0700 $10.00 - I run Ruby Debugger as follows D:>ruby -r debug myprog.rb Debug.rb Ema... http://guruza.com/question/529/reward-10.00 I run Ruby Debugger as follows D:>ruby -r debug myprog.rb Debug.rb Emacs support available. D:/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:10:require 'rubygems' (rdb:1) b myprog.rb 3 Set breakpoint 1 at myprog.rb 3 (rdb:1) c I'm running on WIndows XP My programs run through without stoping at line 3. How do I get it to break? Sat, 05 May 2007 17:42:49 -0700 $5.00 - I am doing flash[:error] = "Hello World!" in my controller, and it shows prop... http://guruza.com/question/528/reward-5.00 I am doing flash[:error] = "Hello World!" in my controller, and it shows properly in my view. However, flash[:error] is only deleted after the -second- time it is shown, which means that if I enter a wrong password, then navigate to the "lost password" page, I get a message saying "Invalid username or password" on -both- pages. What's the deal? AFAIK, Rails is supposed to delete the flash after it is rendered the first time. Fri, 04 May 2007 11:59:34 -0700 $5.00 - How setup Ruby on Rails Application on Godaddy Hosting!! Need live example! http://guruza.com/question/520/reward-5.00 How setup Ruby on Rails Application on Godaddy Hosting!! Need live example! Tue, 24 Apr 2007 10:13:34 -0700 $25.00 - I want to have my Javascript inject some HTML on the fly but I hate to put HT... http://guruza.com/question/500/reward-25.00 I want to have my Javascript inject some HTML on the fly but I hate to put HTML in my js because it belongs in the view, not the public folder. I thought I could be slick and do something like this in a view to get the HTLM stored in a js variable: htmlVar = '<%= render :partial => "some/partial" %>'; Unfortunately this gets screwed up by the line-returns in the partial. Is there a way to make this work or achieve a similar result using RJS or the Minus-R plugin? Thu, 15 Mar 2007 12:29:55 -0700 $20.00 - I need to make a simple rails app where an admin user can create "recordings"... http://guruza.com/question/490/reward-20.00 I need to make a simple rails app where an admin user can create "recordings". Each "recording" has the following types of information: * Title * URL to a .zip * The number of "editions" to make of this "recording The idea is that for each "edition" there is URL generated (for instance, mydomain.com/85876) that takes you to a page where you see the Title and a download begins of the "URL to a .zip" mentioned above. The person that goes to the mydomain.com/85876 should never see the original URL of the .zip, that should be obscured. And that /86876 link should expire within a week of being visited. This a simple scheme for selling music (or other media) by means of selling people the unique URLs (mydomain.com/85876). The more help, the better. Help could be in the form of advice, code snippets or the actual code to build such a system. I've set the reward high, but if only partial help can be offered I'll set a slightly lower reward and pay that. Sat, 17 Feb 2007 12:08:36 -0800 $1.00 - Ruby / Ruby on Rails: I am building a database wrapper in a class. I want... http://guruza.com/question/483/reward-1.00 Ruby / Ruby on Rails: I am building a database wrapper in a class. I want to expose a string array of people (ex: ['john','jane','lucie']) which basically wraps a comma-delimited string column in a legacy database (names are in the db as: 'john,jane,lucie'). I'd like to be able to do: foo.people[1] = 'mark', foo.people.pop or even foo.people.push('richard') and have the changes reflected in the database. How do I hook into an array to be able to perform the underlying database operations? I'm not quite sure how to implement this correctly. Mon, 15 Jan 2007 10:40:57 -0800 $0.00 - I am trying to use sqlite3 for my dev database with my Rails app (1.2rc2). I... http://guruza.com/question/482/reward-0.00 I am trying to use sqlite3 for my dev database with my Rails app (1.2rc2). I am on OS X so sqlite3 is installed by default (I even installed the lastest version with darwinport), and I have done gem install sqlite3-ruby. However, when I try to do anything that has to do with ActiveRecord, I get errors. Here's an example: >> Domain.new ActiveRecord::StatementInvalid: ActiveRecord::StatementInvalid from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5848/lib/active_record/connection_adapters/sqlite_adapter.rb:273:in `table_structure' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1.5848/lib/active_support/core_ext/object/misc.rb:23:in `returning' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5848/lib/active_record/connection_adapters/sqlite_adapter.rb:272:in `table_structure' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5848/lib/active_record/connection_adapters/sqlite_adapter.rb:210:in `columns' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5848/lib/active_record/base.rb:760:in `columns' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5848/lib/active_record/base.rb:2048:in `attributes_from_column_definition_without_lock' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5848/lib/active_record/locking/optimistic.rb:45:in `attributes_from_column_definition' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5848/lib/active_record/base.rb:1490:in `initialize_without_callbacks' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5848/lib/active_record/callbacks.rb:225:in `initialize' from (irb):1 Any idea? EDIT: The funny thing is that I use sqlite3 and it works great with another project I started some time ago... Mon, 15 Jan 2007 07:58:30 -0800 $20.00 - Ruby question here, I have N number of arrays and I want renturned the elemen... http://guruza.com/question/479/reward-20.00 Ruby question here, I have N number of arrays and I want renturned the elements of the arrays that are common to all the arrays. Example: firstArray = [1,2] secondArray = [2,3] result should be: 2 In this example I could just firstArray & secondArray, but what about situations where you don't know how many arrays this needs to be performed on? A solution would be in the form of a method that takes and array of N number of arrays and returns an array of only the common elements. Sun, 31 Dec 2006 10:26:58 -0800 $25.00 - Ruby question here: I've got an array full of hashes, some of which are ident... http://guruza.com/question/475/reward-25.00 Ruby question here: I've got an array full of hashes, some of which are identical. How can I make take out all the duplicates hashes. I thought my_array.uniq! would do it... but um, it doesn't. Thu, 14 Dec 2006 11:37:15 -0800 $76.00 - I am very frustrated with iterm on OS X. I love many of the features but I k... http://guruza.com/question/459/reward-76.00 I am very frustrated with iterm on OS X. I love many of the features but I keep having issue with the wrong characters being sent to the shell. For instance, Meta-Backspace works fine in bash locally, but does not work remotely. It also does not work in my postgres shell or my irb (Ruby) shell. Mon, 11 Dec 2006 09:47:35 -0800 $20.00 - I have a hash in ruby that looks like this: [ {"video_id": 3,"tag_id": 2}... http://guruza.com/question/449/reward-20.00 I have a hash in ruby that looks like this: [ {"video_id": 3,"tag_id": 2}, {"video_id": 3, "tag_id": 4}, {"video_id": 3, "tag_id": 8}, {"video_id": 5, "tag_id": 2}, {"video_id": 5, "tag_id": 9} ] And I want it broken up into an array the tag_id's that are common to all the video_id's present. In above case, the array would be: common_tags[0] = 2 because tag_id number 2 is the only tag that is common to both video_id's 3 and 5. Fri, 01 Dec 2006 09:02:24 -0800 $5.00 - I want to use ActionMailer outside of Rails. Whats the best way of accomplish... http://guruza.com/question/421/reward-5.00 I want to use ActionMailer outside of Rails. Whats the best way of accomplishing this? Tue, 03 Oct 2006 09:41:03 -0700 $5.00 - I want to save ruby code inside a database, retrieve it and execute it. Is it... http://guruza.com/question/408/reward-5.00 I want to save ruby code inside a database, retrieve it and execute it. Is it possible to execute a string returned by the database as ruby code? Thu, 14 Sep 2006 17:33:54 -0700 $0.00 - Whenever I try to compile ruby-1.8.5, the configure commands throws error tha... http://guruza.com/question/372/reward-0.00 Whenever I try to compile ruby-1.8.5, the configure commands throws error that its unable to check the size of rlim_t Fri, 01 Sep 2006 12:05:25 -0700 $0.00 - I am new to ruby on rails and doing a simple application as I am studying rub... http://guruza.com/question/368/reward-0.00 I am new to ruby on rails and doing a simple application as I am studying ruby on rails. I have a m:n relationship between people and languages ... a person can know many langs and a lang can be known by many people ... I want to give a GUI in which there are 2 lists of languages for a person to edit 1 with the languages he knows 2 other languages .. I want to allow him to add & remove languages ie shift from one list to the other list Eg: if person1 has english and french in the database , the lists would look like List1: english french List2: spanish italian german etc etc etc... [ plz note: they are side by side ] and he can double click or do something to select a lang in list2 and add it to list1 and vice versa... I thought it would be a good excerise to learn ruby but I am struck .. I wanted to know if there is any helper class available for this kinda feature... Can someone suggest me as to how I can do this efficiently in ruby.. [ I currently have a string which has all languages seperated by comma and the user can modify the string.. I parse the string @ the controller and store it into the database.. ] Thu, 31 Aug 2006 21:12:38 -0700 $0.00 - I am new to ruby on rails and am writing a simple database application... ... http://guruza.com/question/363/reward-0.00 I am new to ruby on rails and am writing a simple database application... I have people table and languages table... they have m:n relationship using languages_people table [ has_and_belongs_to_many ] now i was able to access all langs for a person using just person1.languages [ array of language] i have displayed it to front end ... which will be edited and sent back to the controller... here i need to update the languages of that person.... i dont know how to do it... i tried to delete all previous languages and then addnew all of them ... but was not able to... as i am very new to this framework, i dont have a clue as to what to do... After reading the features offered by ruby on rails I am very much sure that there is a simple and easy way to do this .... can anyone help me.... giving me the syntax to delete all languages corresponding to a person , and adding languages into it will be great... [ if there is a better method plz let me know..] when i tried to add them using [ here i have copied all langs from frontend to temp_langs] for lang in temp_langs @person.languages << Language.new( :name => lang ) end it created new enteries in languages table and then added into relation... which is not what i want... i dont want to add a new entry into languages table ... i want to add an entry only in the languages_people table plz... awaiting your response... Wed, 30 Aug 2006 21:16:47 -0700 $5.00 - My site spans ajax requests that take a while to execute on the server. Howe... http://guruza.com/question/360/reward-5.00 My site spans ajax requests that take a while to execute on the server. However, this request becomes invalid if the user makes another request before the first one is completed. In order to save server resources, I'd like to be able to kill the 1st server request when the second one is sent. I was thinking about polling the session to see if a certain criteria is met. If it is, I'd just abort the current call. How would I do that? I guess I'd have to launch a second thread when the ajax request starts (on the server side) and that thread would poll the session every 100ms or so. If the criteria is met, it would kill the request. I'd like to see a code example of this. Wed, 30 Aug 2006 00:25:10 -0700 $20.00 - *Rails Output Streaming* I am revisiting this again because I am in a situat... http://guruza.com/question/358/reward-20.00 *Rails Output Streaming* I am revisiting this again because I am in a situation where I need output streaming. Rails has two methods that utilize streaming (send_data, send_file) I've modified this to meet my needs, along with the help of people on the mailinglist. However the code below which should work, does not provide output streaming. I know in the past output streaming has worked within rails, I am wondering if in a current release it has been broken. Whatever the case is, I need to determine why I cannot get the output streaming mechanism in rails to work. I'm using lighttpd on fc5. I've used mongrel with the same results. class TestController < ApplicationController def index render :text => Proc.new { |resp, out| out.puts 'start' out.flush 10.times do out.puts '.' out.flush sleep 1 end out.puts 'done' } end end Tue, 29 Aug 2006 14:02:10 -0700 $3.00 - how to get validates_presence_of to work with non-null float/boolean/integer ... http://guruza.com/question/323/reward-3.00 how to get validates_presence_of to work with non-null float/boolean/integer fields? Has anyone figured out a way to get validates_presence_of to work with float, boolean, and integer fields that are defined as non-null in the schema? The problem is, rails intializes these types to the default schema value, which for mysql is never null if the column is not allowed to be null, and as a result they are initialized in the form with a value, and are never null. I found a work around for integers that requires a nasty method override in the ActiveRecord class that sets the default values from the database, but I can not find a solution to do the same for floats because ruby will not let me assign a float to null once it has been initialized with a value. Wed, 16 Aug 2006 16:33:19 -0700 $5.00 - Validating Multiple Models The problem is that when I use error_messages_f... http://guruza.com/question/321/reward-5.00 Validating Multiple Models The problem is that when I use error_messages_for to display validation errors for two models, only the parent model's validation is displayed and not for the relationships. Example. class Resource < ActiveRecord::Base has_one :setting end class Setting < ActiveRecord::Base belongs_to :resource end If I do: @resource = Resource.new @resource.settings = Settings.new @resource.save! Only Resource's validation shows up and not Setting's. Is there anyway that I can validate the relationships of a model? *ANSWER* "if model1.valid? and model2.valid? and model3.valid? save model data" Wed, 16 Aug 2006 11:14:30 -0700 $10.00 - I'm trying to use observe_form, like this: http://pastie.caboo.se/8702 ... http://guruza.com/question/318/reward-10.00 I'm trying to use observe_form, like this: http://pastie.caboo.se/8702 But the text area is not being passed - in fact it appears that it is not serializing the form at all. What am I doing wrong? Answer: I think there's a bug in the rails observe_form function. I put in the prototype code myself and it works great. For some reason, rails isn't adding on the form serialization code. Tue, 15 Aug 2006 09:34:45 -0700 $15.00 - I have a strange issue where my classes are somehow being corrupted by a user... http://guruza.com/question/297/reward-15.00 I have a strange issue where my classes are somehow being corrupted by a user request: Internal protocol error: You have a nil object when you didn't expect it! The error occured while evaluating nil.has_key? Backtrace: (eval):1:in `title' /home/rcollins/myapp/../lib/rails_ext/acts_as_versioned.rb:401:in `write_changed_attribute' Here is the code: def write_changed_attribute(attr_name, value) last_value = self.send(attr_name) How can I debug the eval? Mon, 07 Aug 2006 13:10:44 -0700 $5.00 - When i start WEBrick, it simply says "=> Booting WEBrick..." then returns... http://guruza.com/question/289/reward-5.00 When i start WEBrick, it simply says "=> Booting WEBrick..." then returns to command line. Any idea why? I am using OS X and Ruby 1.8.4. I tried reinstalling Ruby, didn't help. Here's what I get when I run script/console: LLoading development environment. /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require__': no such file to load -- lib/partial_classes/string.rb (MissingSourceFile) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require' from ./script/../config/../config/environment.rb:51 from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `load_modules' from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `load_modules' from /usr/local/lib/ruby/1.8/irb/init.rb:21:in `setup' from /usr/local/lib/ruby/1.8/irb.rb:54:in `start' from /usr/local/bin/irb:13 Mon, 31 Jul 2006 09:34:08 -0700 $0.00 - what is rubyonrails? http://guruza.com/question/287/reward-0.00 what is rubyonrails? Sun, 30 Jul 2006 01:55:29 -0700