-
Notifications
You must be signed in to change notification settings - Fork 124
Updated Gem to support Rails 6/7 #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
3d9ffd6 to
8eca96e
Compare
Added Rspec and Appraisals with minor tweaks Added Rspec and Appraisals Updated gitignore Updated Appraisals gemfiles
45bd0ab to
8ca4989
Compare
app/models/survey/attempt.rb
Outdated
| scope :looses, -> { where(winner: false) } | ||
| scope :scores, -> { order('score DESC') } | ||
| scope :for_survey, ->(survey) { where(survey_id: survey.id) } | ||
| scope :exclude_survey, ->(survey) { where("NOT survey_id = #{survey.id}") } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where.not(survey_id: survey.id)
app/models/survey/attempt.rb
Outdated
| end | ||
|
|
||
| def collect_scores | ||
| answers.map(&:value).reduce(:+) || 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are changing the behavior here by not setting the self.score field like we used to
|
|
||
| def generate_active_admin_resolution | ||
| copy_file "active_admin.rb", "app/admin/survey.rb" | ||
| copy_file 'active_admin.rb', 'app/admin/survey.rb', force: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you add the force flag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to remove, it was from previous tests
lib/survey.rb
Outdated
| require 'survey/active_record' | ||
|
|
||
| ActiveRecord::Base.send(:include, Survey::ActiveRecord) | ||
| ActiveRecord::Base.include Survey::ActiveRecord |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rails 5 added the ApplicationRecord. If the file exists, we should use it instead of ActiveRecord::Base
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm okok, i will change it now 👍🏼
lib/survey/version.rb
Outdated
| module Survey | ||
| VERSION = "0.1" | ||
| end | ||
| VERSION = '0.1' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's bump this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bump version to 0.2?
- Updated tests for spec
- Updated factories for factory_bot