diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index da3f83a..9cdac57 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1330,7 +1330,7 @@ module ApplicationHelper end def template_options(klass, field_name) - templates = klass.templates(environment.id) + templates = klass.templates(environment) return '' if templates.count == 0 return hidden_field_tag("#{field_name}[template_id]", templates.first.id) if templates.count == 1 diff --git a/app/models/profile.rb b/app/models/profile.rb index 5f4b393..48ed800 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -68,7 +68,7 @@ class Profile < ActiveRecord::Base #FIXME: these will work only if the subclass is already loaded named_scope :enterprises, lambda { {:conditions => (Enterprise.send(:subclasses).map(&:name) << 'Enterprise').map { |klass| "profiles.type = '#{klass}'"}.join(" OR ")} } named_scope :communities, lambda { {:conditions => (Community.send(:subclasses).map(&:name) << 'Community').map { |klass| "profiles.type = '#{klass}'"}.join(" OR ")} } - named_scope :templates, lambda { |environment_id| { :conditions => {:is_template => true, :environment_id => environment_id} } } + named_scope :templates, lambda { |environment| { :conditions => {:is_template => true, :environment_id => environment.id} } } def members scopes = plugins.dispatch_scopes(:organization_members, self) diff --git a/app/views/templates/index.html.erb b/app/views/templates/index.html.erb index 48f165a..1060a0c 100644 --- a/app/views/templates/index.html.erb +++ b/app/views/templates/index.html.erb @@ -2,9 +2,9 @@ <%= _('Manage the templates used on creation of profiles') %> -<% list_of_templates = [[_('Person') , Person.templates(environment.id) , 'person' ], - [_('Community') , Community.templates(environment.id) , 'community' ], - [_('Enterprise'), Enterprise.templates(environment.id), 'enterprise']] %> +<% list_of_templates = [[_('Person') , Person.templates(environment) , 'person' ], + [_('Community') , Community.templates(environment) , 'community' ], + [_('Enterprise'), Enterprise.templates(environment), 'enterprise']] %> <% list_of_templates.each do |title, templates, kind|%>