This is the default error header on validation headers: * errors prevented this * from being saved The only information I found on how to override this is as follows: http://wiki.rubyonrails.org/rails/pages/OverridingRailsMessagesInAnotherLanguage My only other alternative would be to have the controller check with the model to see if each field is valid, and if not, send back a custom message to the view for each field. This would obviously be extremely verbose, and an overkill.... but all the alternatives look to be an overkill. Am I correct in my above assumptions ? If so, I may have to jump in and submit my first patch, which would at least allow an override of the validation header. Thanks ! _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
In trying to discover how I might go about filtering records by attributes in their related tables, I''ve found myself doing the hunt for Rails documentation again. "dynamic finders" would seem to be what I''m looking for. I was hot on the trail behind this posting: http://wrath.rubyonrails.org/pipermail/rails/2005-January/001590.html where we are directed to this page in the documentation: http://ar.rubyonrails.com/classes/ActiveRecord/Base.html and told to look under "Dynamic attribute-based finders". Which is not mentioned. At all. Can anyone point me in the right direction? Maybe there''s a better way to go about it. Basically, with 2 tables sharing a habtm relationship, I''d like to find all records in one table, which have a relationship to a particular record in the other. The dynamic finders would seem to only be able to work on columns in a single table. cheers Mark Beattie Easy Schedule Management http://easy-online-schedule.com
Mark Beattie wrote:> Maybe there''s a better way to go about it. Basically, with 2 tables sharing a > habtm relationship, I''d like to find all records in one table, which have a > relationship to a particular record in the other. The dynamic finders would > seem to only be able to work on columns in a single table.I think what you want is: class A has_and_belongs_to_many :bs end a = A.find(id) a.bs.find( :all, :conditions => ''...'' ) or, if :conditions are empty, just "a.bs". The API docs state that a find on a habtm only takes an id parameter, while the latest rails code clearly also supports all non-dynamic forms of ActiveRecord::Base.find. http://api.rubyonrails.com/classes/ActiveRecord/Associations/ClassMethods.html#M000457 -- We develop, watch us RoR, in numbers too big to ignore.
On Friday 04 November 2005 3:07 pm, Mark Reginald James wrote:> I think what you want is: > > class A > has_and_belongs_to_many :bs > end > > a = A.find(id) > a.bs.find( :all, :conditions => ''...'' ) > > or, if :conditions are empty, just "a.bs".Nice one, thanks. I found you can also do: A.find(id).bs to skip a line of code. Thanks to the "Ruby" in Ruby on Rails. Mark Beattie Easy Schedule Management http://easy-online-schedule.com