similar to: validate two dates, 2date - 1date > 1month

Displaying 20 results from an estimated 70000 matches similar to: "validate two dates, 2date - 1date > 1month"

2008 Nov 21
5
Getting the number of years between two dates
Hey, I need to get the number of years (as a number) between two dates. Here is what I have as a helper. # Returns the number of years between now and the specified date. def years_ago(date) dateDifference = DateTime.now - date results =Date.day_fraction_to_time(dateDifference) return results[0] / 24 / 365; end I''m sure there is a better way to do this. What is it?
2006 Dec 14
12
Saving dates
Hi having trouble saving dates in my form i have the following in the view <%= date_select("details", "open_date") %> and i have @exhibition.open_date = params[:details][:open_date] and then @exhibition.save All the other values form (not seen here) get saved but not the dates. What am i doing wrong ? -- Posted via http://www.ruby-forum.com/.
2008 May 09
4
Validating Uniqueness From Two Database Tables?
Well, I''m working on adding a new type of user (organization) to my application, using a different database table than the standard User table (in the end, I think it works out being easier to deal with than creating another column in the original User table for account type). However, I''m running into a user registration problem. I can register both types of users fine,
2006 Dec 16
2
Validate some fields only on object creation, not update
I''m having a problem with my User model. Originally I had alot of validation, including this: validates_presence_of :password_confirmation, :password validates_length_of :password, :within => 4..50 validates_confirmation_of :password However, this made it impossible to edit a user without setting his password, which I don''t want. So I tried to isolate the above validations
2008 Jan 18
2
validate mac address field
Hi to all, i''d like to insert a validation inside my model about a mac address field. I''ve used this sintax but it''s not working. validates_format_of :mac_address, :with => /^((?:[-a-f0-9])+(?:[-a-f0-9])+(?:[-a-f0-9])+(?:[-a-f0-9])+(?:[-a-f0-9])+(?:[-a-f0-9]))$/i, :on => :create,
2009 Feb 19
8
validate for street
Hallo all, can someone tell me what can be the regulare expression for this: "The Road", "The Road 12", "Road", "On the Road 89". -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this
2007 Apr 29
2
Validate unique within date range?
I''m setting up a simple system for listing products and specials. I''m looking for a way to validate that only one special can exist per product per date range. For example, if a product is on sale from 2007-04-29 to 2007-05-10, you cannot create a special for that product that starts on 2007-05-09. What''s the best way to do this with Rails? I''m fairly new to
2007 Feb 13
7
Specs of code that use Time.now
Hi Just trying to spec a Rails model that defaults a valid_until date to this time tomorrow. I''ve done something similar involving Dates, and you can stub the :today method to return something fixed. But when I tried this with Time, I found that RSpec calls Time.now four times per spec. So there''s no way to spec code like 1.days.from_now . The best I can come up
2008 Jan 02
1
Invalid Dates in sqlserver adapter
/usr/local/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-1.0.0/lib/active_record/connection_adapters/sqlserver_adapter.rb" -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2007 Aug 29
12
ruby on rails search engine
He all, who can recommend me search engine(search for different models) for my web-site? ps: i know about ferret for example, but maybe there are some others? Thank you -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this
2008 Feb 05
3
NEED: Localization tool and Rails 2.0.2
Hello, I need a localization tool/plugin for my rails application that work with REST, can translate whole web pages(or i can create 2 different pages for 2 languages), and fast. Thanks for any suggestions!!!! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on
2008 Jun 02
5
validate - message in the flash[:error]
Hi, I want to show the validate - message in the flash[:error] - field but I can''t find any options. An example: class UserPermission < ActiveRecord::Base validates_presence_of :name, :message => "Please insert a name" ... | end V flash[:error] = "Error - " Has anybody a solution for this
2006 May 26
3
validate a form NOT connected to a model
Is there any way to validate a form that isn''t connected to a model. I have a form that connects to a controller action and I want to validate the inputs on the form like I would with the validates_ATTRIBUTE_of property on a model. Is there any way to do this? -------------- next part -------------- An HTML attachment was scrubbed... URL:
2007 Oct 15
6
Form with two buttons
Hi, I need to make a form with two buttons. But I do wrong. And why not can be. form: ------------------------------- <%= form_tag :controller => ''establishment_contents'', :action => ''llamada'', :opMenu => opcionMenu %> [...] <%= image_submit_tag ("../images/incluir.gif", :op=>"addImage") %> [...] <%=
2007 Oct 16
6
netbeans6 + RoR errors
I''m having problems with running RoR applications, either imported from existing source or by creating a new project in NetBeans 6 beta 1. When I use the menu "run / test project" or "run / run main project" I get an error very similar to this: (from test) (in C:/flame-svn/test/RailsApplication1) "C:/flame-svn/test/RailsApplication1/config/boot" rake
2008 Jan 16
4
How to test if one range of dates overlaps another?
Hi all, I have a situation with a recurring billing application where I need to test if one range of dates "overlaps" another range of dates. Does anyone know a rails find or mysql select statement that will test for this? Here are the details: * Recurringcharge items have a start_date and an end_date that represent the period of time that the charges should occur. * Statement items
2008 Aug 27
5
VALIDATION QUESTION
I''m trying to validate a record before save. I''m using one controller in this case furnii where I have all my calls. The problem is that, the form containing the field I''m trying to validate resides in the furnii views. I tried to add validates_presence_of :content (the field name) in both the furnii model and the ratecomment model but it does not work. I know there
2006 Aug 16
3
Validate your forms with a table-less model
Ive followed this example of how to validate a form with a tableless model: http://rails.techno-weenie.net/tip/2005/11/19/validate_your_forms_with_a_table_less_model Ive got this example working but when validation fails the failed boxes are not highlighted in red. At the moment i have a contact details form and want to validate the information entered by the user but this will just result
2007 Aug 12
4
Date and Time validator, updater
Can someone point me to a date/time validator or updater. I have an event start datetime and an event end datetime. I want to validate that the end datetime is after the start datetime. Figure there is some code or library out there already, if you know one, please forward it. Thank you! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are
2006 Sep 29
1
Rails validation scheme: why not validate params directly.
Hi. There are many ways of doing validation but I''m trying to think of the cleanest way without making the action code unclean. Would it be advisable to do validation on the incoming params hash rather than waiting to setup an object you are about to save and calling ojb.valid? before saving? Or even going as far as trying to save the object but failing from the model''s