Guruza search results for rails,validation http://guruza.com/searches/show/387 Questions recently submitted to Guruza that match the query: rails,validation Thu, 20 Nov 2008 16:29:24 -0800 $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 - 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 $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 need to write a validation that checks the value of one input before decidi... http://guruza.com/question/96/reward-10.00 I need to write a validation that checks the value of one input before deciding whether the content of another input is correct. What is the best way to approach this in Ruby on Rails? Sun, 11 Jun 2006 10:55:45 -0700