Displaying 5 results from an estimated 5 matches for "prepend_text".
2005 Dec 27
0
Re: RESOLVED: Overloading error_message_on method in ActiveRecordHelper
...calling the
method as if it had. But when I changed the definiton to one with a
hash that simulates keywords, it works just fine:
---
module ActionView
module Helpers
module ActiveRecordHelper
def error_message_on(object, method, params = nil)
if params.class == Hash
prepend_text = params[:prepend_text] || ""
append_text = params[:append_text] || ""
css_class = params[:css_class] || "formError"
span = params[:span] || false
end
if errors = instance_variable_get("@#{objec...
2005 Dec 23
1
Overloading error_message_on method in ActiveRecordHelper
...e ''active_record_helper_fix''
---
..and a lib directory with active_record_helper_fix.rb like this:
---
require ''action_view/helpers/active_record_helper''
module ActionView
module Helpers
module ActiveRecordHelper
def error_message_on(object, method, prepend_text = "",
append_text = "", css_class = "formError", span = false)
if errors = instance_variable_get("@#{object}").errors.on(method)
content_tag(span ? "span" : "div",
"#{prepend_text}#{errors.is_a?(Array) ? errors.first...
2007 Jan 03
2
error_message_on broken?
Hi,
in my app, using the error_message_on form helper like this:
<label for="user_name">User name:</label>
<%= error_message_on ''user'', :name %>
<%= f.text_field :name %>
generates the following error:
undefined method `errors'' for :user:Symbol
I am using edge revision 5813 and the simply_helpful plugin. Is there a
way to fix this?
2006 Sep 14
0
Work around for problems with error_message_on
Hey all
I was encountering problems with error_message_on in the fact that it
caused an exception when no object by that name had any errors (or did
not exsist) so i created this work around...
def display_error(obj, method, prepend_text = "", append_text = "",
css_class = "form_error")
object = instance_variable_get("@#{obj}")
if object && !object.errors.empty?
errors = object.errors.on(method)
if errors
content_tag("div", "#{prepend_text}#...
2009 Nov 27
1
Nested model + error message
Hello Friend,
I want to override the default error message, but some how I am not able to
implement it.
The scenario is
I have a user table and user detail table I have implement nested model.
And the below mention message is appearing and instead of that I want
something "User Name cannot be blank"
- *User detail given name can''t be blank*
Thanks
Abhis
--
You