Displaying 20 results from an estimated 30000 matches similar to: "Validation of Correct Date Submitted on Form"
2008 Nov 19
3
Rails.cache and problem with model id?
I have the following:
MODEL:
def self.get_tag_cloud
Rails.cache.fetch(''fetish_tag_cloud'', :expires_in => 1.hour) do
find(:all, :conditions => [ "approved_for_tag_cloud = true"], :order
=> "LTRIM(name)")
end
end
CONTROLLER:
def index
@fetishes = Fetish.get_tag_cloud
end
VIEW:
....
<% @fetishes.each do |fetish| -%>
2008 Dec 05
1
Question About Rails.cache and find method.
The DB load on my site is getting really high so it is time for me to
cache common queries that are being called 1000s of times an hour
where the results are not changing.
So for instance on my city model I do the following:
def self.fetch(id)
Rails.cache.fetch("city_#{id}") { City.find(id) }
end
def after_save; Rails.cache.delete("city_#{self.id}"); end;
def
2006 Apr 13
0
Custom validation of form fields?
I have been looking at the many validates_* methods that we have
available and I am wondering is it possible to create a custom
validation method to be performed on a form field?
I have the following form (remote via ajax)
<%= form_remote_tag :url => {
:action => ''do_action'',
:id => @pid },
:before =>
2006 Oct 25
1
Capistrano, Media Temple and their Grid Servers
Hey Everyone,
According to the comments section in this blog post MediaTemple has
their own capistrano deploy script:
http://blog.vixiom.com/2006/10/12/media-temple-tames-the-beast-new-ruby-on-rails-hosting-service-with-mongrel/
The problem is that this deploy script refers to a file called
''mt-capistrano'' that I can''t find anywhere.
Does anyone have any suggestions
2006 Nov 02
4
Still Having Problems With :through When Going To Same Table... Help... please :-(
I am having a problem with doing a :through that goes back to the same table.
The following are my two classes:
>>>>>
class User < ActiveRecord::Base
has_many :spanks
has_many :spanked, :through => :spanks, :source => :spanked_user
has_many :was_spanked_by, :through => :spanks, :source => :user
end
class Spank < ActiveRecord::Base
belongs_to :spanker,
2005 May 04
1
Conditional validations
I''ve been working with the problem that Joe Hosteny has been talking
about on this list and on the tickets he''s posted
(http://dev.rubyonrails.com/ticket/1196) and have come up with a
tentative solution that I''d like to bring up here.
What if we use a "conditional" parameter in the validates_* methods?
Here''s how it would look like in practice:
2006 Jun 20
1
Possible to check if form field is required?
Hi list,
is it possible to check if form field will be required when form is
submitted (through validates_presence_of or some other validates_*
method)? I could do this manually but it doesn''t seems to me very DRY.
For example, I would like to be able to dynamically add asterisk with
some helper method if city is required here:
City*: <%= text_field
2006 Jul 14
7
Form validation - keepin correct fields displayed on refresh
All,
I''m finally doing my first real form in Rails - the model object that
I''m entering information for has 8 validations so far.
If I type in good values for all the fields but one, I get the pretty
validation, and the nice field highlighting, but all of the fields are
cleared, forcing me to retype all of that info. That is a big drag.
Is there a standard way to get the
2006 Feb 14
1
Additional Model Validation
I created a method to do additional validation on my model. How can
I have that run whenever a model is being saved? (For now I don''t
want to extend AR.)
John Kopanas
http://www.kopanas.com
=====================================================================
http://www.soen.info - source of the freshest software engineering
information on the net
http://cusec.soen.info -
2006 Jun 10
1
Validating Object Without Saving It
Is their a way to validate an object without saving it?
So I can do something like this
if user.save
else
end
But where save is just validating it but not actually saving it into
DB. I just don''t want to save the object yet.
Thanks guys and gals :-)
John Kopanas
http://www.kopanas.com
============================================================
http://www.soen.info - Index of
2006 Apr 27
0
DRY validation
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all,
A few months ago someone posted a message about specifying validates_*
constraints on a per-attribute basis. I just created a small plugin
that
allows you to do this.
Here''s an example from one of my models:
class Country < ActiveRecord::Base
attribute :name, :string do |a|
a.validates_length :within =>
2006 Apr 26
0
Validation of params
As we all know you cannot trust anything you receive from the internet.
I am wondering what the correct RoR way is to solve this. For the model
there are various validates_* methods that you can use to ensure some
integrity of that part. That is good by itself. Though it would be nice
if setting these would also result in enforcement in the database backend
itself when supported. Here I am as
2006 Jun 18
1
plugings for date validations, email address validation & url validations in rails
Hi all,
Is there any standard plugin available for date validations, email address
validation & url validations in rails?
Thanks in advance,
Medha.
--
If not you then who.....
If not now then when......
-----------------------------------------------------
With Best Regards,
Medha.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2011 Feb 28
2
form level validation, where to do it.
Form level validation involving enforcing a relation between two or
more form inputs that may not even be in the model:
I am building a form that will query a range of records between two
dates.
The form ask for a starting data and a ending date.
I want to validate that the user selected a starting data before or
equal to the ending date.
It seems that this validation should happen in the
2006 Jan 30
1
Either/Or Validation
How would I use validations to ensure I either received a blank value or
a ten digit number?
If I set validates_length_of :field, :in => 0..10 then that would allow
any value in-between. The allow_nil => true option does not seem to
work.
I''ve also tried using this with some combination of
validates_numericality_of but cannot get it to work.
Any help would be greatly
2006 Mar 20
2
Capistrano, ftp user and svn user are different
What do you do when the ftp login username is different then the svn
username?
Every time I try to deploy it gets stuck right here:
[kopanas.com] executing command
** [out :: kopanas.com] Authentication realm: <http://kopanas.com:80>
kopanas.com
** [out :: kopanas.com] Password for ''jkopanas'':
** [out :: kopanas.com] subversion is asking for a password
** [out ::
2006 Mar 13
32
DRY principle form validations
We are wondering how you''d validate a credit card number or a SSN
without writing Javascript and Ruby code.
Would it be through Rails'' AJAX support?
--
Posted via http://www.ruby-forum.com/.
2006 Jan 04
2
how to display validation error messages for multiple record form
I am trying to figure out how to display model validation error messages for
a multiple record form.
My form is for setting up new accounts and collects information for two
models - Accounts and Users.
My create method collects the parameters from the form and adds them to a
Account object and a User object then runs account.valid? and user.valid?.
If it''s valid it updates the models
2007 Jun 21
1
Validation Through Multiple Models from one Form
Hey All,
I have a form that submits data to multiple models.
I have
class Man < ActiveRecord::Base
has_many :notes
has_many :contacts
validates_associated :contacts, :notes
validates_presence_of :first_name
validates_presence_of :last_name
class Contact < ActiveRecord::Base
belongs_to :man
validates_presence_of :contact_info
class Note < ActiveRecord::Base
2006 Feb 13
3
Getting Rid of Error Divs around fields that have errors
Is there a way to get rid of the divs around an error field. These
divs are causing me headaches. Any suggestions :-)?
John Kopanas
http://www.kopanas.com
=====================================================================
http://www.soen.info - source of the freshest software engineering
information on the net
http://cusec.soen.info - software engineering conference