Displaying 20 results from an estimated 30000 matches similar to: "Print an asterisk along with required fields"
2011 Sep 12
0
How to get the image_path in production without the asset host?
Hi guys,
I would like to know how to get the image_path in production environment
without the asset host (using rails 3.1).
There is the image_path helper that returns the image path with md5 and (if
set, and it is set) the asset host, but we have not found a way to get the
path without the host.
Does anyone know how to do that?
Bruno Grasselli
Blog: http://brunograsselli.com.br
Twitter:
2009 Dec 16
2
Twitter rails Plugin
Do you know any good rails plugin for twitter?
Thnaks,
--
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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
2006 Aug 14
3
validating required fields during an update?
I have a User model with an email attribute. I''m using the following
validations:
validates_confirmation_of :email
validates_format_of :email,
:with => RFC822::EmailAddress,
:message => "must be a valid address in the form user@domain.com"
validates_uniqueness_of :email, :message => "address has already
been taken. If you''ve forgotten your
2010 Jul 30
0
testing in template for required attribute
Is there a way to say in the template Model.required?(attribute) if
validates_presence_of is used on the attribute?
--
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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
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
2010 Oct 06
0
Error customization problem.
Hi,
I have following models
class User < ActiveRecord::Base
has_many :addresses, :as =>:addressee, :dependent => :destroy
accepts_nested_attributes_for :addresses, :allow_destroy => true
end
class Address < ActiveRecord::Base
belongs_to :addressee, :polymorphic => true
validates_presence_of :address1, :maximum => 50,:message => "Address1
cannot be
2007 Jan 23
0
validates_presence_of fields. in parent ok, but how in children?
i have the problem that my child class fileds aren''t validated on
saving the
parent. working with parent and child works without problems.
if all fields are filled correctly everything is saved as expected.
but missing fields in the child arent added to the errors.
following short sample shows what i try:
Model
-----------------------------------------------------
class Parent <
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
2007 May 08
3
How to restore fields ("validates_presence_of")
Hi all,
I am using "validates_presence_of" for validating all fields of my
registration form. It is working fine and generating custom error
message as mentioned.
Also clearing all fields. How can restore those fields which are already
filled.
Problem is "validates_presence_of" clearing (blank) field if it fails,
instead of restoring fields which are already filled.
Help.
2010 Apr 14
1
Rails validations app specific problems
Hi all,
I have a unique workflow where it''s making the use of validations
difficult.
My app is for internal use in my company and I have a funky
implementation (inspired by the e-commerce Railscasts episodes) of a
cart. I have products which when I "add to cart" creates an order with a
state of "incomplete". The product is a line item of my order. Hope that
makes
2012 Nov 17
2
Help needed for error in foreign key validation
I have two models bank and country. User should only associate a Bank with
a country id present in the country table and I put validates presence of
country to enforce it but i get error mysql2::Error: Unknown column
''countries.bank_id'' in ''where clause'': SELECT `countries`.* FROM
`countries` WHERE `countries`.`bank_id` = 17 LIMIT 1 when updating the bank
2006 Mar 10
1
Validate fields and display errors from two models?
Hi,
I have here a problem I''ve been working at for a little while but I
can''t seem to get the error messages to appear correctly.
My form looks something like this for "ModelA":
[errors_for "modelA"]
[form for "modelA"]
[text "modelA" "fieldname1"]
[text "modelB" "fieldname2"]
[submit]
[/form]
The reason
2006 Aug 16
0
validates_presence_of 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, ruby 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
2008 Apr 17
0
Having problem with validates_presence_of fields in form when trying to also use ActiveScaffold (x-posted at ActiveScaffold group)
I have an events listing site that includes the models Event and
DateAndTime, so an event that happens more than once (like a high
school play) can have more than one date_and_time. The Event model
has_many date_and_times, and the DateAndTime model belongs_to event.
The Event model validates_presence_of two submission form variables,
the_date and the_time, and those variable values then get used
2010 Mar 17
3
Associating a default paperclip image from a different model
Here''s some code, this is my NewsItem model as you can see...
class NewsItem < ActiveRecord::Base
belongs_to :country
has_attached_file :image, :styles => { :original => ''57x57'' },
:default_url => ''/images/football.png''
# has_attached_file :image,
# :styles => { :original => ''57x57'' },
2010 Aug 28
1
validates_uniqueness_of missing in rails 3.0 rc2?
Has anybody noticed validates_uniqueness_of missing in rails 3.0 rc2? I''m not sure if this is a bug or I''m just doing something wrong.
Here''s what I''m doing.
Class 1:
class Title < ActiveRecord::Base
validates_length_of :language, :is => 3
validates_uniqueness_of :language, :scope => :book_id
validate :language,
2007 Feb 26
2
boolean db fields set to false fail validation with validates_presence_of?
I have a model that contains a :boolean field. In my view, I have a
simple select of Yes or No, which equates to true or false,
respectively. If I choose yes and save, everything works great. If I
choose no, my model fails validation as I have this set as a required
field using validates_presence_of. I have checked the log and it''s
definitely set to false, why would this fail validation?
2010 Jun 19
1
Is validates_presence_of() deprecated in Rails 3?
Just wondering if validates_presence_of() has been deprecated in
favour of validates(:name, :presence => true) or we can prefer to use
any?
Asking so, since NetBeans 6.9 shows a deprecation warning, however I
can not find any such deprecation message in documentations/code of
Rails 3.0.0.beta4 and on web.
--
You received this message because you are subscribed to the Google Groups "Ruby
2012 Apr 05
0
Polymorphism, acts_as_relation gem and nested attributes
I have the following polymorphic association set up with
acts_as_relation (https://github.com/hzamani/acts_as_relation)
Model code:
class Email < ActiveRecord::Base
belongs_to :detail
validates_presence_of :address
end
class Detail < ActiveRecord::Base
acts_as_superclass
has_many :emails
accepts_nested_attributes_for :emails, allow_destroy: true
2010 Feb 01
3
validating both sides of a has_one relationship breaks pickle/machinist tests
A lot has been posted about validation issues with associations,
however, I don''t see this issue addressed specifically.
ex:
class Foo
has_one :schedule, :dependent => :destroy
validates_presence_of :schedule
class Schedule
belongs_to :foo
validates_presence_of :foo_id
this creates a circular dependency that breaks test frameworks like
pickle and machinist.
At first I was