Skip to content
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

Allow it to be used without ActiveRecord being present #72

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

hugomelo
Copy link
Contributor

When you use include? ActiveRecord::Base, you expect that module/class to be loaded. Changed the verification to use a text representation of the module

Copy link
Owner

@a-chacon a-chacon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @hugomelo really thank you for your contribution! Please fix the syntax I indicated, and the PR could be merged. I recommend to you run Rubocop in your local before push your changes, so you can be sure that no problems will be.

Just let me know any problem or question, thank you again!

lib/oas_rails/builders/content_builder.rb Outdated Show resolved Hide resolved
lib/oas_rails/builders/request_body_builder.rb Outdated Show resolved Hide resolved
@@ -60,7 +60,7 @@ def process_non_hash_content(content)
maybe_a_model, errors = content.gsub('@', "").split(".")
klass = maybe_a_model.singularize.camelize(:upper).constantize

if klass.ancestors.include?(ActiveRecord::Base)
if klass.ancestors.map{|a| a.to_s }.include? 'ActiveRecord::Base'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing before

lib/oas_rails/yard/oas_rails_factory.rb Outdated Show resolved Hide resolved
@a-chacon a-chacon added the enhancement New feature or request label Jan 29, 2025
When you use include? ActiveRecord::Base, you expect that module/class
is loaded. Changed the verification to use a text representation of the
module
@hugomelo hugomelo force-pushed the fix_active_record_error branch from 8e18573 to 04ca722 Compare January 29, 2025 17:41
@hugomelo
Copy link
Contributor Author

I have updated the commit

Copy link
Owner

@a-chacon a-chacon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hugomelo thank you!

@a-chacon a-chacon merged commit 340157d into a-chacon:main Jan 29, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants