I have this render in a method controller:
render :json => @boats, :include => {:port => {:only => [:id, :name], :include => {:city => {:only => [:id, :name], :methods => :translatedCity}}}}
but translatedCity method in the model should accept language parameter.
def translatedCity
language = params[:language]
puts "translatedCity.language=" + language
city = TranslationService.translateCity(self.city_id, language)
return city.element_translation
end
I have the parameter in the controller. Is there any way to pass this parameter to the method in the model?