I''d like that whenever a certain column / property of an ActiveRecord based object is rendered to text, a method be called - which I can override - rather than the default of just dumping the column contents. This makes thngs like i18n, bool -> Yes/No, enum -> expanded, and the like much smoother. Of course, I can do these by simply manually inserting the method call everywhere, but that defeats a lot of what is nice and beautiful about rails... I''d like to be able to use the scaffolding and the like, just, where I need it, override the method. I know I can override the method for returning the contents (Overwriting default accessors - http://api.rubyonrails.com/classes/ActiveRecord/Base.html ), but I don''t want to do this, as it can break internal logic - I only want to override the method for rendering to text.
If you''ve used the generator for scaffolding then there should be plenty of options for you to customize in the controllers'' views. ------------------------------------------------------------------------ /*Ronny Hanssen*/ Lst Recv wrote:> I''d like that whenever a certain column / property of an ActiveRecord > based object is rendered to text, a method be called - which I can > override - rather than the default of just dumping the column > contents. > > This makes thngs like i18n, bool -> Yes/No, enum -> expanded, and the > like much smoother. Of course, I can do these by simply manually > inserting the method call everywhere, but that defeats a lot of what > is nice and beautiful about rails... > > I''d like to be able to use the scaffolding and the like, just, where I > need it, override the method. I know I can override the method for > returning the contents (Overwriting default accessors - > http://api.rubyonrails.com/classes/ActiveRecord/Base.html ), but I > don''t want to do this, as it can break internal logic - I only want to > override the method for rendering to text. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >