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

How to require_relative helper methods from a seed file? #82

Open
cirosantilli opened this issue Oct 26, 2014 · 0 comments
Open

How to require_relative helper methods from a seed file? #82

cirosantilli opened this issue Oct 26, 2014 · 0 comments

Comments

@cirosantilli
Copy link

I want to share some helper methods across multiple seed files:

db/fixtures/development/01.rb
db/fixtures/development/02.rb
db/fixtures/development/helper.rb

the problem is that require_relative does not work because the seed files are run with eval: http://stackoverflow.com/questions/16421669/ruby-require-relative-gives-loaderror-cannot-infer-basepath

Is there a way to require using relative paths from the seed files? The best I could come up with was using Rails.root.join, but that is not very DRY.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant