# Radiant Bug

**URL:** <https://www.ruby-forum.com/t/radiant-bug/126427>\
**Category:** Radiant CMS\
**Created:** [January 18, 2008, 6:02am UTC](https://www.ruby-forum.com/t/radiant-bug/126427 "2008-01-18T06:02:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [January 18, 2008, 6:02am UTC](https://www.ruby-forum.com/t/radiant-bug/126427/1 "2008-01-18T06:02:15Z")

</div>

I want to bring a bug to the attention of the newsgroup that I haven’t  
been able to track down. John has asked that I post this here in hopes  
that one of you might be able to identify this issue and submit a patch.

In some cases Radiant is failing to provide validation error messages to  
users. Instead of providing specific messages tied to the offending  
fields, they only get the one error message across the top of the  
screen. When that’s their only message it comes across like “Oops, you  
goofed. Now let’s see if you’re smart enough to figure out where. Mwaa  
haa haa haaa!” (well, ok different users read things differently).

Now, this doesn’t happen in every installation. I notice a relationship  
depending on whether I’m running radiant via gem or with radiant  
installed in my project’s /vendor directory (running from gem works  
fine, installed in /vendor doesn’t). Please note: this is an  
observation and a starting point but I haven’t proven anything so far.

By the way, the Radiant Demo ([http://demo.radiantcms.org](http://demo.radiantcms.org)) is missing  
these error messages.

My ticket is here: [http://dev.radiantcms.org/radiant/ticket/601](http://dev.radiantcms.org/radiant/ticket/601)

-Chris

---

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [January 18, 2008, 4:57pm UTC](https://www.ruby-forum.com/t/radiant-bug/126427/2 "2008-01-18T16:57:38Z")

</div>

> From what I’ve found out, the generic error messages you’re talking  
> about come from  
> Admin::AbstractModelController#announce\_validation\_errors (in  
> app/controllers/admin/abstract\_model\_controller.rb). Neither the  
> layout for all of the admin controllers or the individual templates  
> for any of the actions call the standard error\_messages\_\* helpers,  
> which (unless I’m missing another better way to access them) would be  
> the best way to access the validation error messages and report them  
> in the view.

Looking through a couple of revisions, I haven’t actually found any  
where the errors are reported that way, so I’m a bit at a loss for why  
it would be working with the gem.

I can, however, verify that the demo site shows the  
less-than-desirable behavior.

-Andrew

On Jan 18, 2008 12:01 AM, Chris P.

---

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [January 18, 2008, 5:48pm UTC](https://www.ruby-forum.com/t/radiant-bug/126427/3 "2008-01-18T17:48:14Z")

</div>

Alright, so I made a instance with the 0.6.4 gem and was able to  
replicate that we used to get feedback. The thing is, the pertinent  
view code is the same.

Which got me thinking that it might have something to do with Rails  
2.0? Does anyone know if the error message handling was changed?

Another possible problem might be that the templates are not using the  
form\_for helper, and are instead just outputing form tags. Perhaps  
there’s some magic state underneath it all that’s set by this tag?

I’ll look into this some more after lunch.

-Andrew

---

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [January 18, 2008, 9:20pm UTC](https://www.ruby-forum.com/t/radiant-bug/126427/4 "2008-01-18T21:20:34Z")

</div>

Ugh, now I can’t replicate with edge… I must have been mistaken.

And ignore what I said about Rails 2.0… looking in svn, I see that  
the Rails 2.0 upgrade is in a different branch.

In any event, the only other thing I’d suggest to you Chris, is to  
check your environment.rb and make sure it has something like this  
(should be near the bottom):

ActionView::Base.field\_error\_proc = Proc.new do |html, instance|  
%{

#{html} •  
#{[instance.error\_message].flatten.first}
}  
end

-Andrew

---

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [January 18, 2008, 10:11pm UTC](https://www.ruby-forum.com/t/radiant-bug/126427/5 "2008-01-18T22:11:58Z")

</div>

Andrew O’Brien wrote:

> %{
> 
> #{html} •  
> #{[instance.error\_message].flatten.first}
> }  
> end
> 
> -Andrew

Thanks for your hard work Andrew. I’ll take a look later this evening.

But it’s not me I’m concerned about – after all the RadiantCMS demo  
site shows the same behavior. I’m concerned that this could be a  
widespread bug – one that we wouldn’t hear about from our users because  
they’d just think “this is frustrating - but that’s just the way it has  
to be.” Something that goes against the design ethic of Radiant, I  
think.

-Chris

---

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [January 19, 2008, 6:21am UTC](https://www.ruby-forum.com/t/radiant-bug/126427/6 "2008-01-19T06:21:45Z")

</div>

Hi Chris,

Looks like that line was added in Changeset 576 (Nov 6, 2007):

[http://dev.radiantcms.org/radiant/changeset/576#file8](http://dev.radiantcms.org/radiant/changeset/576#file8)

If you generated your instance before that, that change won’t be  
reflected.

-Andrew

On Jan 19, 2008 12:11 AM, Chris P.

---

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [January 19, 2008, 6:12am UTC](https://www.ruby-forum.com/t/radiant-bug/126427/7 "2008-01-19T06:12:25Z")

</div>

Andrew O’Brien wrote:

> %{
> 
> #{html} •  
> #{[instance.error\_message].flatten.first}
> }  
> end
> 
> -Andrew

Well, you may have hit on it Andrew. If I look at my project with  
radiant installed in the /vendor directory, I see the code you mention  
in:  
/vendor/radiant/config/environment.rb

but not at:  
/config/environment.rb

And adding the code to the /config/environment.rb seems to fix it. So  
can anyone explain why these versions are different (and if it’s  
actually a Radiant issue)? (Actually there are more differences in  
these files than just this one but most of the others seem explainable).

And I might consider trying to write a patch but I don’t even know what  
I’m trying to patch – a rake task maybe? Nor am I sure what kind of  
testing that would require. Can anyone on core offer some insight here?

-Chris
