[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Cleare errors on a given attribute

Fyodor Golos

12/29/2006 5:05:00 PM

I've been studying Rails source code to figure out how to clear
ActiveRecord errors for a given attribute name. It appears that there is
no direct API to do that. The best workaround I found is this:

active_record.errors.add(attribute_name, "dummy").clear

Basically, "add" returns an array of error messages for given attribute
name, which I subsequently clear. Seems to work, but doesn't feel
"right".

In case anyone wonders why in the world I needed such functionality,
here is a brief explanation. I have an object with a has_many
association. If any of the children fail validation, the following error
is displayed for the parent object: "(insert association name here) is
invalid". I do not find this particular error message to be very
informative and instead would rather display exact children errors.
Hence, I would like to make a sweep over parent object errors and remove
any errors on associations after validation but before rendering.

If anyone has any better suggestions on better displaying children
errors, I am all ears :)

Regards,
Fyodor Golos

--
Posted via http://www.ruby-....

4 Answers

Fyodor Golos

12/29/2006 5:09:00 PM

0

My bad. Wrong list. Reposted in "Ruby on Rails"

--
Posted via http://www.ruby-....

Myself Mallu, Yourself?

12/15/2011 4:14:00 AM

0

Forwarded post from "MM,Y?"

On 12/14/2011 4:03 PM, fanabba wrote:
> On Dec 14, 4:53 pm, use...@mantra.com and/or www.mantra.com/jai (Dr.
> Jai Maharaj) wrote:
>> In article<b541aa24-8ced-4b03-aa89-613543f65...@f11g2000yql.googlegroups.com>,
>> fanabba<fana...@aol.com> posted:
>>
>>
>>
>>> Iraq: Muslims murder Christian couple as they walk to their car
>>
>>> http://www.jihadwatch.org/2011/12/iraq-muslims-murder-chris......
>>
>> Dhanyavaad for your post.
>> Islam is a terrorist cult.
>>
>> Jai Maharaj, Jyotishi
>> Om Shanti
>
> Dhanyavaad for your comment.
> You are of course right, as always !

Dhanyavaad for your dhanyavaad to Lady Kaka's dhanyavaad and "Islam is
Terrorist Cult" comment. Are you sure that she did not cut and paste
your dhanyavaad? Surprising that Lady "Gora Bhaiyya" Kaka (is the fem.
of "gora bhaiyya" "gori behen" or "gori bhaiyyi?) could type out two
complete sentences, that too in angrezi. I thought Lady "The Cow of
Hawaii" Kaka strictly used "saniskrit" at home and elsewhere too. Did
the heavy Veds fall on the fraud's head while he was doing "the jog"?

VB, Ubetjotushy
'ome=shanty

-----
About the Cartoon Squad:
---------------------------------------------------------------------
A cartoon is someone like The Muckeraj (Koochie), Hoochie and Poochie.

"Jade Muckeraj" aka "The Old Cow of Hawaii" <charlatan@fraudsrus.com>
tries her best to pretend she is a Hindu -- cutting and pasting, and
even doctoring what others post/write on the internet, deliberately
pidginizing Sanskrit and providing wrong translations, inventing brand
new books in the Mahabharat (reducing it to Muckabharat), stalking and
abusing people who disagree with her by hijacking their posts, and
then cuts and pastes about Hindu ethics -- and succeeds spectacularly
in convincing all, except other toons, that she is not a Hindu. Soon
after her PMS (Punnarakiya Muckeraj Society) was established, Lady
"The Muckeraj" Kaka has had a cow regularly. So regularly that
she now sings, "Kehte hain mujhko Cow of Hawaii" much to the delight
of the other toon (and fan) Poochie, who has declared Lady Kaka to be
a "ho".

usenet

12/15/2011 4:21:00 AM

0

In article <b541aa24-8ced-4b03-aa89-613543f654af@f11g2000yql.googlegroups.com>,
fanabba <fanabba@aol.com> posted:
>
> Iraq: Muslims murder Christian couple as they walk to their car
>
> http://www.jihadwatch.org/2011/12/iraq-muslims-murder-christian-couple-as-they-walk-to-thei...

Dhanyavaad for your post.
Islam is a terrorist cult.

Jai Maharaj, Jyotishi
Om Shanti

-----

About the Goon Squad:

---------------------------------------------------------------------
A goon is a bully or thug who terrorizes or tries to do away with
opposition.

"Myself, Mallu. Yourself?" (V. Bhattathiri) <KalluMallu123@gmail.com>
tries his best to be a bully -- telling others what and when to post,
where to post and where not to post, deliberately publishing lies
about others, stalking and abusing them with hate speech -- but fails
miserably. He is really stressed out, and like his lap dog Prem
Thomas (who currently posts as "P. Rajah", and issues death threats
to people), is priming himself for conditions such as stroke and
heart disease.
---------------------------------------------------------------------

Topaz

12/16/2011 1:37:00 AM

0


"The Judeo-Christian Death Cult - Why Bush, Cheney, Hagee, Dobson,
Robertson, and other Neocons Approve Torture, Genocide and Human
Sacrifice on Behalf of God's "Chosen People:" Texe Marrs examines the
startling collapse of traditional Christianity as its leaders replace
Jesus with Israel as their central focus. The Great Commission is no
longer to preach Jesus and the Cross, but to exalt the Jews and defend
Israel. In pursuit of this radical new objective, Christian leaders
endorse Israel's murder and oppression of Palestinians, Lebanese, and
other supposed "enemies." Moreover, whatever it takes - torture, lies,
gulags, or genocide - all are encouraged if Israel's political goals
are advanced. Evangelical Christianity is being rapidly transformed
into a global Death Cult."
Howard Duck


http://ww... http://www....

http://national-socialist-worldview.bl...