search for: human_attribute_nam

Displaying 12 results from an estimated 12 matches for "human_attribute_nam".

Did you mean: human_attribute_name
2006 Jun 08
5
Field names in validators
Hi! Is there a (simple) way to use alternative field names in validation messages? For example, if I have a validator like this one: validates_presence_of :email how can I make it print a message like "E-Mail Address can''t be blank" instead of "Email can''t be blank"? I can override the "can''t be blank" part by using the :message
2011 Oct 25
1
Customizing errors
..._name attribute. Now if a validation goes wrong, I would like the message to say: "Name of author can''t be blank" as opposed to "author name can''t be blank". I have tried looking into the Rails Guides for I18n #5 but it seems error.full_messages does not call human_attribute_name on the attribute before rendering the message. So I created a workaround which I have shared http://igbanam.wordpress.com/2011/10/25/customizing-error-messages-in-rails/ Comments and constructive criticisms please. -- You received this message because you are subscribed to the Google Groups &qu...
2007 Dec 05
5
Active Record, Migration, and Translation
Hi, I think the columns and table in migration should be able to have an optional "display_name" set manually. Something like: create_table :people, {display_name => "Personne"} do |t| t.column :first_name :string, :display_name => "Prénom". end Let me explain my point of view: Rails is a framework made to write programs in English. You see it when you
2011 Mar 29
18
Rails 3.0.6.rc1
ZOMG HAPPY TUESDAY (UTC-7)!!! <3<3<3<3<3 I am happy to announce that the first release candidate for Rails 3.0.6 has been pushed to rubygems.org. ## Release Candidate: What does it mean? The release candidate is very similar to what we will actually release for version 3.0.6. The reason that we release an RC is so that the community can have a chance to postpone or veto commits
2006 Mar 01
5
validations without AR - going crazy trying to find link
Hi, in the past few months someone posted an entry on their blog about how to do validations in non-AR classes and I cant find it any more. Anyone have a link? Thanks, Trevor -- Trevor Squires http://somethinglearned.com
2006 Jan 19
2
Easy way to handle form input without a model class?
I have a couple forms that I''d like to be able to validate and automatically populate, but it shouldn''t be based on AR. In fact I often have a bunch of small forms that I can''t really justify writing a whole new model class for anyway. I''d like to validate the form input, and then use rails helpers to automatically populate the form if validations fail.
2010 Aug 24
0
ActiveRecord display different text for attribute on validation
...e in the validation presented to the user than the actual attribute? I have a field "trade_attached_pdf" Which AR creates the error message "Trade attached pdf may only be in pdf format" But I want the message to read "Attached pdf may only be in pdf format" I found human_attribute_name in AR.base but is not clear how to implement. I have not done much with I18n, is that where I should perhaps be looking instead? David -- 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 rubyonr...
2006 Feb 22
5
Auditing mixin for model classes. Small problem
...def before_changes old=self.class.find(id).attributes @changes=[] attributes.each do |key, val| if val != old[key] change = Change.new(:primary_key_id=>id, :table=>self.class.table_name, :attribute=>self.class.human_attribute_name(key), :old=>old[key], :new=>val) @changes << change end end end def after_changes if(@changes.size>0) @changes.each {|change| change.save} end end end I now want to include it like this in my model class : class Customer <...
2006 Jun 01
3
more questions: human_name
One more question: Is there some way to set the human_name of a column? e.g.: human_name for column address1 shouldn''t be Address1 but "Address, line 1". If not, should I make a hash with my custom names? Best regards, -- ---------------------------------------------------------------------- Yannick Majoros http://www.inma.ucl.ac.be/~majoros Informaticien UCL/INMA-MEMA
2008 Feb 27
8
ActiveRecord validation messages not I18N-friendly and enforces grammar
...as follows: If the :message argument is given to a validates_whatever, then check whether the :message string contains "%{fn}". If so, then the full validation error message should be formatted using the :message string, like this: full_message = message.sub(''%{fn}'', human_attribute_name) If no "%{fn}" is given, then it should check whether the following is true: message.chars.capitalize == message If so, then the full validation error message should equal that of the message argument. This allows one to specify a full sentence in the :message parameter, without Act...
2006 Jul 05
2
Serialized object behaves weird
Hi! I got a class named EinsatzFilter which I serialized to session. Before saving to session it works afterwards I keep getting the message: "undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from ActiveRecord::Base inherited class. Code: class EinsatzFilter include ApplicationHelper attr_reader :personen, :monat, :projekte, :kunde
2009 Nov 26
9
ActionView::TemplateError (can't convert ActiveRecord::Error into String)
I cannot work out why this error is appearing. ActionView::TemplateError (can''t convert ActiveRecord::Error into String) on line #3 of app/views/button/_show_enquiry.html.erb: 1: <h1>Send us a message</h1> 2: <% remote_form_for :enquiry, :url => {:action => ''send_mail''} do | f| %> 3: <%= error_messages_for ''enquiry'',