Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: fred fred
RE: Use Gloc in model [ reply ]  
2006-11-10 13:04
I have solved the problem
I had this in application.rb

before_filter :check_language
def check_language
if session[:lang]== "en"
set_language :en
else
set_language :fr
end
end

and modify my model like this

errors.add :difficulty, l(:localized_recipedifficultymissing) unless
self.difficulty.nil? || self.difficulty > 0


By: fred fred
Use Gloc in model [ reply ]  
2006-11-03 15:16
hi

I have no problem to use Gloc in view like this :
<%= l(:localized_test)%>

but when I try to use it in a model:

def validate
errors.add({}, l(:localized_test)) unless
self.difficulty.nil? || self.difficulty > 0
end

I got this error :
GLoc::StringNotFoundError in RecipeController#create

if someone use Gloc in a model ...
thanks in advance
fred