voluntary 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. data/app/assets/javascripts/voluntary/application.js +1 -1
  2. data/app/assets/javascripts/voluntary/base.js.coffee +30 -1
  3. data/app/assets/stylesheets/voluntary/application.css +1 -0
  4. data/app/assets/stylesheets/voluntary/base.css.sass +1 -1
  5. data/app/controllers/areas_controller.rb +6 -5
  6. data/app/controllers/candidatures_controller.rb +15 -10
  7. data/app/controllers/concerns/voluntary/v1/base_controller.rb +95 -0
  8. data/app/controllers/devise_extensions/registrations_controller.rb +2 -2
  9. data/app/controllers/organizations_controller.rb +7 -6
  10. data/app/controllers/professions_controller.rb +6 -5
  11. data/app/controllers/projects_controller.rb +11 -6
  12. data/app/controllers/users_controller.rb +2 -2
  13. data/app/controllers/vacancies_controller.rb +14 -5
  14. data/app/controllers/voluntary/api/v1/api_controller.rb +9 -0
  15. data/app/controllers/voluntary/application_controller.rb +2 -66
  16. data/app/controllers/workflow/candidatures_controller.rb +1 -1
  17. data/app/controllers/workflow/products_controller.rb +7 -7
  18. data/app/controllers/workflow/stories_controller.rb +1 -1
  19. data/app/controllers/workflow/tasks_controller.rb +2 -2
  20. data/app/controllers/workflow/user/product/areas_controller.rb +2 -2
  21. data/app/controllers/workflow/user/projects_controller.rb +10 -2
  22. data/app/helpers/voluntary/application_helper.rb +79 -0
  23. data/app/helpers/voluntary/collection_helper.rb +45 -0
  24. data/app/helpers/voluntary/comments_helper.rb +13 -0
  25. data/app/helpers/voluntary/form_helper.rb +46 -0
  26. data/app/helpers/voluntary/language_helper.rb +17 -0
  27. data/app/helpers/voluntary/layout_helper.rb +42 -0
  28. data/app/helpers/voluntary/product_helper.rb +36 -0
  29. data/app/helpers/voluntary/show_helper.rb +67 -0
  30. data/app/helpers/voluntary/wizard_helper.rb +29 -0
  31. data/app/models/ability.rb +20 -4
  32. data/app/models/candidature.rb +10 -7
  33. data/app/models/column.rb +1 -0
  34. data/app/models/concerns/user/extensions.rb +5 -0
  35. data/app/models/concerns/user/listable.rb +10 -0
  36. data/app/models/list.rb +30 -0
  37. data/app/models/list_item.rb +22 -0
  38. data/app/models/organization.rb +1 -0
  39. data/app/models/page.rb +2 -1
  40. data/app/models/product.rb +3 -2
  41. data/app/models/project.rb +2 -2
  42. data/app/models/result.rb +1 -0
  43. data/app/models/role.rb +1 -1
  44. data/app/models/state_machines/candidature.rb +17 -1
  45. data/app/models/state_machines/story.rb +15 -2
  46. data/app/models/state_machines/task.rb +33 -0
  47. data/app/models/story.rb +3 -2
  48. data/app/models/task.rb +44 -6
  49. data/app/models/thing.rb +3 -0
  50. data/app/models/user.rb +15 -4
  51. data/app/models/vacancy.rb +7 -5
  52. data/app/presenters/resources/general/wizards/story/steps/setup_tasks_presenter.rb +1 -1
  53. data/app/presenters/shared/collection/table_presenter.rb +1 -1
  54. data/app/views/candidatures/index.html.erb +1 -1
  55. data/app/views/candidatures/show.html.erb +1 -1
  56. data/app/views/columns/_collection.html.erb +0 -0
  57. data/app/views/comments/_resource.html.erb +1 -1
  58. data/app/views/layouts/application.html.erb +12 -0
  59. data/app/views/layouts/shared/_navigation.html.erb +3 -3
  60. data/app/views/organizations/show.html.erb +0 -1
  61. data/app/views/products/index.html.erb +53 -4
  62. data/app/views/projects/_form.html.erb +1 -0
  63. data/app/views/projects/show.html.erb +2 -1
  64. data/app/views/shared/collection/_list.html.erb +1 -1
  65. data/app/views/shared/resource/_actions.html.erb +2 -2
  66. data/app/views/stories/_column_fields.html.erb +0 -0
  67. data/app/views/stories/_form.html.erb +1 -1
  68. data/app/views/stories/steps/_activate.html.erb +1 -1
  69. data/app/views/workflow/products/show.html.erb +1 -1
  70. data/app/views/workflow/project_owner/_candidatures.html.erb +2 -1
  71. data/app/views/workflow/tasks/_work_head.html.erb +1 -1
  72. data/app/views/workflow/tasks/steps/_complete.html.erb +6 -2
  73. data/app/views/workflow/tasks/steps/_review.html.erb +6 -2
  74. data/app/views/workflow/tasks/steps/_work.html.erb +4 -2
  75. data/app/views/workflow/user/product/areas/show.html.erb +0 -0
  76. data/app/views/workflow/user/projects/show.html.erb +0 -0
  77. data/config/initializers/devise.rb +2 -5
  78. data/config/initializers/filter_parameters_logging.rb +1 -0
  79. data/config/initializers/friendly_id.rb +88 -0
  80. data/config/initializers/wrap_parameters.rb +15 -0
  81. data/config/locales/general/en.yml +15 -9
  82. data/config/locales/resources/story/en.yml +1 -0
  83. data/config/routes.rb +9 -0
  84. data/config/routes/workflow.rb +15 -15
  85. data/db/migrate/20120907144853_create_schema.rb +1 -1
  86. data/db/migrate/20120922201955_create_mongo_db_documents.rb +1 -1
  87. data/db/migrate/20121004132105_create_professions.rb +1 -1
  88. data/db/migrate/20121006162913_add_public_attribute_to_roles.rb +20 -1
  89. data/db/migrate/20130817090734_create_lists.rb +33 -0
  90. data/db/migrate/20131018143613_replace_user_by_polymorphic_resource_in_candidatures.rb +46 -0
  91. data/db/migrate/20140307113214_add_user_id_to_organizations.rb +5 -0
  92. data/lib/api_constraints.rb +10 -0
  93. data/lib/applicat/mvc/model/tree.rb +1 -1
  94. data/lib/concerns/model/base_list_item.rb +30 -0
  95. data/lib/concerns/model/base_thing.rb +50 -0
  96. data/lib/db_seed.rb +15 -4
  97. data/lib/generators/voluntary/install/install_generator.rb +17 -16
  98. data/lib/generators/voluntary/install/templates/app/views/layouts/application.html.erb +17 -1
  99. data/lib/generators/voluntary/install/templates/config/main_navigation.rb +1 -260
  100. data/lib/generators/voluntary/install/templates/features/support/integration_sessions_controller.rb +1 -2
  101. data/lib/generators/voluntary/install/templates/spec/factories.rb +19 -0
  102. data/lib/generators/voluntary/install/templates/spec/support/mongo_database_cleaner.rb +14 -4
  103. data/lib/generators/voluntary/product_dummy/product_dummy_generator.rb +23 -17
  104. data/lib/generators/voluntary/product_dummy/templates/config/database.example.yml +1 -1
  105. data/lib/generators/voluntary/product_dummy/templates/dummy/spec/factories.rb +19 -0
  106. data/lib/generators/voluntary/product_dummy/templates/dummy/spec/spec_helper.rb +75 -0
  107. data/lib/generators/voluntary/product_dummy/templates/features/support/integration_sessions_controller.rb +1 -2
  108. data/lib/generators/voluntary/product_dummy/templates/spec/factories.rb +19 -0
  109. data/lib/voluntary.rb +10 -22
  110. data/lib/voluntary/engine.rb +27 -3
  111. data/lib/voluntary/navigation.rb +358 -0
  112. data/lib/voluntary/test/rspec_helpers/factories.rb +123 -0
  113. data/lib/voluntary/version.rb +1 -1
  114. data/vendor_extensions/active_model/naming.rb +1 -1
  115. metadata +526 -308
  116. data/app/helpers/application_helper.rb +0 -65
  117. data/app/helpers/collection_helper.rb +0 -35
  118. data/app/helpers/comments_helper.rb +0 -11
  119. data/app/helpers/form_helper.rb +0 -43
  120. data/app/helpers/language_helper.rb +0 -15
  121. data/app/helpers/layout_helper.rb +0 -39
  122. data/app/helpers/product_helper.rb +0 -34
  123. data/app/helpers/show_helper.rb +0 -65
  124. data/app/helpers/wizard_helper.rb +0 -27
  125. data/app/observers/candidature_observer.rb +0 -29
  126. data/app/observers/story_observer.rb +0 -6
  127. data/app/observers/task_observer.rb +0 -34
  128. data/lib/voluntary/helpers/application.rb +0 -69
  129. data/lib/voluntary/helpers/collection.rb +0 -35
  130. data/lib/voluntary/helpers/comments.rb +0 -15
  131. data/lib/voluntary/helpers/form.rb +0 -43
  132. data/lib/voluntary/helpers/language.rb +0 -19
  133. data/lib/voluntary/helpers/layout.rb +0 -28
  134. data/lib/voluntary/helpers/product.rb +0 -36
  135. data/lib/voluntary/helpers/show.rb +0 -69
  136. data/lib/voluntary/helpers/wizard.rb +0 -31
@@ -0,0 +1,42 @@
1
+ module Voluntary
2
+ module LayoutHelper
3
+ def breadcrumbs
4
+ result = render_navigation context: application_navigation, renderer: :breadcrumbs_without_method_links, join_with: ' > '
5
+ result = result && result.scan('<a').length > 1 ? result : ''
6
+
7
+ if respond_to?(:resource) && resource.respond_to?(:ancestors)
8
+ breadcrumbs_with_ancestors(result)
9
+ else
10
+ result
11
+ end
12
+ end
13
+
14
+ def breadcrumbs_with_ancestors(links)
15
+ links = links.split(' &gt; ')
16
+ current_resource_link = links.pop
17
+ links += resource.ancestors.map {|ancestor| link_to ancestor.name, ancestor }
18
+ links << current_resource_link
19
+ raw links.join(' &gt; ')
20
+ end
21
+
22
+ def sidenav(links_count = 2)
23
+ links_count ||= 2
24
+ result = render_navigation context: application_navigation, renderer: :twitter_sidenav, level: @twitter_sidenav_level
25
+
26
+ result && result.scan('<a').length >= links_count ? result : ''
27
+ end
28
+
29
+ def footer_navigation
30
+ links = []
31
+
32
+ ['privacy-policy', 'terms-of-use', 'about-us'].each do |page_name|
33
+ text = t("pages.#{page_name.gsub('-', '_')}.title")
34
+ path = "#{controller_name}/#{params[:id]}"
35
+ active = path == "#{controller_name}/#{page_name}"
36
+ links << (active ? text : link_to(text, page_path(page_name)))
37
+ end
38
+
39
+ raw links.join(' | ')
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,36 @@
1
+ module Voluntary
2
+ module ProductHelper
3
+ def render_product_specific_presenter_if_available(resource, partial_path, method, options = {})
4
+ if @presenter.respond_to?(method)
5
+ @step_presenter = @presenter.send(method)
6
+ else
7
+ @step_presenter = nil
8
+ end
9
+
10
+ render_product_specific_partial_if_available(resource, "#{partial_path}/#{method}", options)
11
+ end
12
+
13
+ def render_product_specific_partial_if_available(resource, partial_path, options = {})
14
+ path = nil
15
+ partial_path = partial_path.split('/')
16
+ file_name = partial_path.pop
17
+ partial_path = partial_path.join('/')
18
+
19
+ if resource && resource.respond_to?(:product) && resource.product
20
+ path = "products/types/#{directory_for_resource(resource.product)}/#{partial_path}"
21
+
22
+ path = [path, file_name].join('/')
23
+
24
+ begin
25
+ return render(path, options)
26
+ rescue ActionView::MissingTemplate
27
+ path = nil
28
+ end
29
+ end
30
+
31
+ path = [partial_path, file_name].join('/') if path.blank?
32
+
33
+ render path, options
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,67 @@
1
+ module Voluntary
2
+ module ShowHelper
3
+ def show_attributes(*attributes)
4
+ result = ''
5
+
6
+ attributes.each {|attribute| result += show_attribute attribute}
7
+
8
+ raw result
9
+ end
10
+
11
+ def show_attribute(attribute, options = {})
12
+ title = options[:title] || attribute_translation(attribute)
13
+ value = options[:value] || resource.send(attribute)
14
+
15
+ value.blank? ? '' : content_tag(:dt, title) + content_tag(:dd, value)
16
+ end
17
+
18
+ def show_associations(*associations)
19
+ result = ''
20
+
21
+ associations.each {|association| result += show_association association}
22
+
23
+ raw result
24
+ end
25
+
26
+ def show_association(association)
27
+ if association.to_s == association.to_s.pluralize
28
+ return show_attribute(
29
+ association,
30
+ title: t("#{association}.index.title"),
31
+ value: raw(resource.send(association).map{|a| link_to a.name, a}.join(', '))
32
+ )
33
+ end
34
+
35
+ title = if general_attribute?(:parent)
36
+ t("attributes.#{association}")
37
+ else
38
+ if resource.send(association)
39
+ t("activerecord.models.#{root_model_class_name(resource.send(association)).underscore}")
40
+ else
41
+ t("activerecord.models.#{association}")
42
+ end
43
+ end
44
+
45
+ if resource.send(association)
46
+ show_attribute(
47
+ association,
48
+ title: title,
49
+ value: link_to(resource.send(association).try(:name), resource.send(association))
50
+ )
51
+ else
52
+ ''
53
+ end
54
+ end
55
+
56
+ def show_actions
57
+ result = content_tag :dt, raw('&nbsp')
58
+ result += content_tag :dd, render(
59
+ partial: 'shared/resource/actions', locals: {
60
+ type: root_model_class_name(resource).tableize, resource: resource
61
+ }
62
+ )
63
+
64
+ raw result
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,29 @@
1
+ module Voluntary
2
+ module WizardHelper
3
+ def section_header(wizard_step)
4
+ wizard_step_index = wizard_steps.index(wizard_step) + 1
5
+
6
+ content = ["#{wizard_step_index} / #{wizard_steps.length}"]
7
+ content << t("stories.steps.#{wizard_step}.title")
8
+ content << (future_step?(wizard_step) ? t('general.not_available') : '')
9
+
10
+ content.join(' ')
11
+ end
12
+
13
+ def step_pane(wizard_step)
14
+ return if future_step?(wizard_step)
15
+
16
+ partial_path = wizard_step == :initialization ? 'form' : "steps/#{wizard_step}"
17
+
18
+ if @presenter.respond_to?(wizard_step)
19
+ @step_presenter = @presenter.send(wizard_step)
20
+ else
21
+ @step_presenter = nil
22
+ end
23
+
24
+ render_product_specific_partial_if_available(
25
+ resource, "#{controller_name}/#{partial_path}"
26
+ )
27
+ end
28
+ end
29
+ end
@@ -1,6 +1,8 @@
1
1
  class Ability
2
2
  include CanCan::Ability
3
-
3
+
4
+ @@after_initialize_callbacks = []
5
+
4
6
  def initialize(user, options = {})
5
7
  controller_namespace = options[:controller_namespace] || ""
6
8
  project = options[:project] || nil
@@ -17,7 +19,7 @@ class Ability
17
19
  alias_action :read, :assign_actions, to: :supervisor
18
20
 
19
21
  can :read, [
20
- Area, Profession, Product, Project, Vacancy, Candidature, Story, Task, Result, Comment
22
+ Area, Organization, Profession, Product, Project, Vacancy, Candidature, Story, Task, Result, Comment
21
23
  ]
22
24
  can [:read, :check_name, :check_url, :check_email, :check_email_unblocked], User
23
25
  can :show, Page
@@ -30,20 +32,34 @@ class Ability
30
32
  can [:update, :cancel, :review], Task, user_id: user.id
31
33
 
32
34
  {
33
- user_id: [Product, Project, Candidature, Comment, ProjectUser, Result],
35
+ user_id: [Product, Organization, Project, Comment, ProjectUser, Result],
34
36
  offeror_id: [Vacancy, Story, Task]
35
37
  }.each do |attribute, classes|
36
38
  can :restful_actions, classes, attribute => user.id
37
39
  end
38
40
 
41
+ can :restful_actions, Candidature, resource_type: 'User', resource_id: user.id
42
+
39
43
  can Candidature::EVENTS, Candidature, offeror_id: user.id
40
44
  can Vacancy::EVENTS, Vacancy, offeror_id: user.id
41
45
  can Story::EVENTS, Story, offeror_id: user.id
42
46
  can Task::EVENTS + [:update], Task, offeror_id: user.id
43
47
 
44
- if user.name == 'Master'
48
+ if user.is_master?
45
49
  can [:manage, :moderate, :administrate, :supervisor], :all
46
50
  end
47
51
  end
52
+
53
+ self.class.run_after_initialize_callbacks(self, user, options)
54
+ end
55
+
56
+ def self.add_after_initialize_callback(proc)
57
+ @@after_initialize_callbacks << proc
58
+ end
59
+
60
+ def self.run_after_initialize_callbacks(ability, user, options = {})
61
+ @@after_initialize_callbacks.each do |callback|
62
+ callback.call(ability, user, options)
63
+ end
48
64
  end
49
65
  end
@@ -3,22 +3,21 @@ class Candidature < ActiveRecord::Base
3
3
 
4
4
  belongs_to :vacancy
5
5
  belongs_to :offeror, class_name: 'User'
6
- belongs_to :user
6
+ belongs_to :resource, polymorphic: true
7
7
 
8
8
  has_many :comments, as: :commentable, dependent: :destroy
9
9
 
10
- scope :accepted, where(state: 'accepted')
10
+ scope :accepted, -> { where(state: 'accepted') }
11
11
 
12
12
  validates :vacancy_id, presence: true
13
13
  validates :offeror_id, presence: true
14
- validates :user_id, presence: true, uniqueness: { scope: :vacancy_id }
14
+ validates :resource_id, presence: true, uniqueness: { scope: [:resource_type, :vacancy_id] }
15
15
  #validates :name, presence: true, uniqueness: { scope: :vacancy_id }
16
- validates :text, presence: true
17
16
 
18
- attr_accessible :vacancy_id, :name, :text
17
+ attr_accessible :vacancy, :vacancy_id, :name, :text
19
18
 
20
- #extend FriendlyId
21
- #friendly_id :name, use: :slugged
19
+ extend FriendlyId
20
+ friendly_id :name, use: :slugged
22
21
 
23
22
  before_validation :set_offeror
24
23
 
@@ -27,6 +26,10 @@ class Candidature < ActiveRecord::Base
27
26
  vacancy.project
28
27
  end
29
28
 
29
+ def product
30
+ project.product
31
+ end
32
+
30
33
  private
31
34
 
32
35
  def set_offeror
data/app/models/column.rb CHANGED
@@ -2,6 +2,7 @@ class Column
2
2
  include Mongoid::Document
3
3
  include Mongoid::Timestamps
4
4
  include Mongoid::Slug
5
+ include ActiveModel::MassAssignmentSecurity
5
6
 
6
7
  include Model::MongoDb::Customizable
7
8
 
@@ -0,0 +1,5 @@
1
+ class User
2
+ module Extensions
3
+ extend ActiveSupport::Concern
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ class User
2
+ module Listable
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ has_many :lists
7
+ has_many :list_items, through: :lists
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,30 @@
1
+ class List < ActiveRecord::Base
2
+ attr_accessible :adjective, :topic, :scope, :thing_type, :negative_adjective
3
+
4
+ has_many :items, class_name: 'ListItem', dependent: :destroy
5
+
6
+ validates :adjective, presence: true
7
+ validates :topic, presence: true, uniqueness: { scope: [:adjective, :scope] }
8
+ validates :scope, presence: true
9
+
10
+ #pusherable "#{Rails.env}_channel"
11
+
12
+ def self.find_or_create_by_params(params)
13
+ attributes = (params[:user_list_item] || params[:list_item] || params).clone
14
+ attributes.symbolize_keys! unless params.is_a?(ActiveSupport::HashWithIndifferentAccess)
15
+
16
+ if attributes[:list_id].present? then List.find(attributes[:list_id])
17
+ elsif attributes[:adjective].present?
18
+ list = List.new
19
+
20
+ attributes.each {|param, value| attributes.delete(param) unless list.respond_to?(param) }
21
+
22
+ List.where(attributes).first || List.create(attributes)
23
+ elsif attributes[:topic].present?
24
+ begin
25
+ attributes[:topic].classify.constantize.list
26
+ rescue NameError
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,22 @@
1
+ class ListItem < ActiveRecord::Base
2
+ include Concerns::Model::BaseListItem
3
+
4
+ attr_accessible :list_id, :thing, :thing_type, :thing_id, :best, :stars
5
+
6
+ has_many :user_list_items, dependent: :destroy
7
+
8
+ validates :thing_id, presence: true, uniqueness: { scope: [:list_id, :thing_type] }
9
+ validate :type_equals_thing_type_of_list
10
+
11
+ acts_as_list scope: :list
12
+
13
+ private
14
+
15
+ def type_equals_thing_type_of_list
16
+ return unless list_thing_type = list.try(:thing_type)
17
+
18
+ unless list_thing_type == thing_type
19
+ errors[:thing_type] << I18n.t('activerecord.errors.models.list_item.attributes.thing_type.no_valid_type_for_list')
20
+ end
21
+ end
22
+ end
@@ -7,6 +7,7 @@ class Organization < ActiveRecord::Base
7
7
 
8
8
  has_many :projects
9
9
 
10
+ validates :user_id, presence: true
10
11
  validates :name, presence: true, uniqueness: true
11
12
 
12
13
  attr_accessible :name
data/app/models/page.rb CHANGED
@@ -3,6 +3,7 @@ class Page
3
3
  include Mongoid::Timestamps
4
4
  #include Mongoid::History::Trackable
5
5
  include Mongoid::Slug
6
+ include ActiveModel::MassAssignmentSecurity
6
7
 
7
8
  include StateMachines::Page
8
9
 
@@ -15,7 +16,7 @@ class Page
15
16
 
16
17
  attr_accessible :name, :text
17
18
 
18
- scope :active, where(state: 'active')
19
+ scope :active, -> { where(state: 'active') }
19
20
 
20
21
  validates :user_id, presence: true
21
22
  validates :name, presence: true, uniqueness: true
@@ -1,6 +1,7 @@
1
1
  class Product
2
2
  include Mongoid::Document
3
3
  include Mongoid::Timestamps
4
+ include ActiveModel::MassAssignmentSecurity
4
5
 
5
6
  field :_id, type: String, default: -> { name.to_s.parameterize }
6
7
  field :user_id, type: Integer
@@ -42,7 +43,7 @@ class Product
42
43
 
43
44
  def self.stories(id, user)
44
45
  collection = if id == 'no-name'
45
- Story.exists(_type: false)
46
+ Story.where(_type: 'Story')
46
47
  else
47
48
  product = Product.find(id)
48
49
 
@@ -98,6 +99,6 @@ class Product
98
99
  end
99
100
 
100
101
  def set_klass_name
101
- self._type = get_klass_name
102
+ update_attribute(:_type, get_klass_name)
102
103
  end
103
104
  end
@@ -33,7 +33,7 @@ class Project < ActiveRecord::Base
33
33
 
34
34
  friendly_id :name, use: :slugged
35
35
 
36
- PARENT_TYPES = ['area', 'product', 'user']
36
+ PARENT_TYPES = ['area', 'product', 'user', 'organization']
37
37
 
38
38
  # belongs_to (Mongo DB)
39
39
  def product
@@ -74,6 +74,6 @@ class Project < ActiveRecord::Base
74
74
  end
75
75
 
76
76
  def destroy_non_active_records
77
- stories.all.map(&:destroy)
77
+ stories.destroy_all
78
78
  end
79
79
  end
data/app/models/result.rb CHANGED
@@ -2,6 +2,7 @@ class Result
2
2
  include Mongoid::Document
3
3
  include Mongoid::Timestamps
4
4
  #include Mongoid::History::Trackable
5
+ include ActiveModel::MassAssignmentSecurity
5
6
 
6
7
  include Model::MongoDb::Customizable
7
8
  include Model::MongoDb::Commentable
data/app/models/role.rb CHANGED
@@ -2,7 +2,7 @@ class Role < ActiveRecord::Base
2
2
  has_many :users, through: :user_roles
3
3
  has_many :projects, through: :project_users
4
4
 
5
- scope :public, where(public: true)
5
+ scope :public, -> { where(public: true) }
6
6
 
7
7
  attr_accessible :name, :public
8
8
  end