Guruza search results for rails http://guruza.com/searches/show/62 Questions recently submitted to Guruza that match the query: rails Thu, 28 Aug 2008 13:12:52 -0700 $25.00 - I want to nest a GWT application inside rails. Is there a general way of doin... http://guruza.com/question/532/reward-25.00 I want to nest a GWT application inside rails. Is there a general way of doing this: putting java web apps inside rails? What are the best practices for this kind of thing? Fri, 18 May 2007 11:40:41 -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 $0.00 - I am trying to create tests for a class I have in /components. I have put my... http://guruza.com/question/487/reward-0.00 I am trying to create tests for a class I have in /components. I have put my test file in /test/unit/custom_test.rb but it doesn't run when I do 'rake test'. What's wrong? \ Thu, 01 Feb 2007 11:10:30 -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 $5.00 - I'm a newbie to RoR's and I'm having fun with it. My question has to do with ... http://guruza.com/question/437/reward-5.00 I'm a newbie to RoR's and I'm having fun with it. My question has to do with how to configure a RoR CMS that allows users to publish pages from the CMS to their hosted domain. I want users to be able to login to the CMS to enter their site content. When they create/update information for their site, their domain should be updated as well. NOTE: All users will share the same db tables for storing their information. Originally, I wanted to create static pages in the users domain directory because their pages wouldn't change that often. The static pages would be cached and changed when updated. Now I'm wondering if I should allow users sites to be dynamically generated. I'm not sure which approach would be better or easier to implement. I need to know how to setup or configure my CMS that allows a user to publish to their domain if I decide to publish flat pages to their domain. If I take the dynamic approach, I need to understand how to configure a users domain so that it logs into the database for th user and use their date and the templates that have selected for their web site. Although I'm new to RoR, I'm not new to programming and understand a little bit about servers. It's okay if you get technical. Tue, 31 Oct 2006 20:07:07 -0800 $65.00 - I'm having a weird problem with IE (6 or 7), but it works fine with every oth... http://guruza.com/question/431/reward-65.00 I'm having a weird problem with IE (6 or 7), but it works fine with every other browser I tried. My pages take -forever- to load in IE. For example, a 1kb gif will take like 6-7 seconds to load. I can't figure this one out, anyone has an idea? The site is at http://ajaxwhois.com and Apache/Django is under the hood. I tried disabling Javascript, but no luck. Thu, 19 Oct 2006 21:01:22 -0700 $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 $25.00 - In a RoR application I am making I have a sortable table made using a techniq... http://guruza.com/question/418/reward-25.00 In a RoR application I am making I have a sortable table made using a technique similar to this: http://dev.nozav.org/rails_ajax_table.html This is a two part question: Normally the table is 'unsorted' when you get to it even though the items are alreay in alphabetical order according to the first column. Because of this, the first time you click title to sort by name it appears to do nothing because it was going from 'unsorted' to 'sorted by name' and both are identical. On the first click it should go from 'sorted by name' to 'reverse sorted by name' and the sort_td_class_helper should have the 'sortdown' class applied to it when the page loads. **A solution would either include sample code or enough explanation that I can get it to work.** The other part of the question is how can I make the sorting case-insensive? **A solution would either include sample code or enough explanation that I can get it to work.** Thu, 21 Sep 2006 10:55:10 -0700 $50.00 - I'm building a RoR application that uses sever Ajax.Updater's that load parti... http://guruza.com/question/417/reward-50.00 I'm building a RoR application that uses sever Ajax.Updater's that load partials into DIVs on the page. Unfortunately is the user's session expires it loads the contents of '/user/login' into the DIV that was updated by the Ajax.Updater. Furthermore, this login for doesn't work like the one at '/user/login' **What is the best way around this problem?** A valid answer would include some sample code or a link to some. Ideally the solution would happen on the Rails side of things, but if there is an elegant solution in the form of modify the prototype.js I would accept that as well. Thu, 21 Sep 2006 10:45:19 -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 $2.00 - How do you secure Markdown so that it does not allow javascript with rails? ... http://guruza.com/question/369/reward-2.00 How do you secure Markdown so that it does not allow javascript with rails? I see guruza does it as this link should popup an alert but does not work here. Fri, 01 Sep 2006 02:05:02 -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 $0.00 - I'm trying to set a default controller in my Rails routing. The default cont... http://guruza.com/question/343/reward-0.00 I'm trying to set a default controller in my Rails routing. The default controller should be 'main'. For example, I want /about to route to /main/about. Here's what I have, but it doesn't work: map.connect ':controller/:action/:id', :controller => 'main' Can anyone help? Fri, 25 Aug 2006 00:48:14 -0700 $0.00 - Can anyone help explain what the first set of numbers in WEBrick "Get" calls ... http://guruza.com/question/342/reward-0.00 Can anyone help explain what the first set of numbers in WEBrick "Get" calls refers to? For example what is the 500 in the following: "Get /admin HTTP/1.1" 500 10767 Compared to the 200 in the following: "Get /admin HTTP/1.1" 200 485 The only code I have running is the scaffold code that rails creates. I'm guessing that WEBrick is referring to 2 different locations possibly from multiple installs. Thanks for any input, Joe Noobie Thu, 24 Aug 2006 17:12:24 -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