Hi guys, I''m looking for some advice on how to follow best practices. In my app users can create "reports". A report belongs to an employee. Therefore, when creating a report I want to check, that the chosen employee actually exists and that the user are allowed to use this employee. To do this, I''ve made a custom validation method (in the report model), that checks whether the employee exists or not and whether the user can use this employee. If something''s wrong, it call errors.add_to_base "some text". The problem is, that "some text" needs to be translated according to what user is viewing the page. So essentially, the model needs to have access to both action view methods as well as the session (in order to determine current language). This is afaik very bad practice (to give the model this access). Another solution would be to call @report.errors_add_to_base from the controller - however, that would break the idea of "thin controllers, fat models". Also, it will lead to ugly such as @report.errors.add_to_base t(:error_msg) if something_wrong? if @report.validates? && save # (save seems to clear errors, so I need to call validates before save) # succes else # show error page end So, dear fellow rails users, what do you think of this problem? What would you do here? Any advice very appreciated, thanks. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---