Comments (6)
You don't need the rack_app
block, it will never be called.
Rails isn't loaded when the rakefile gets loaded, it gets loaded once you call a task. So you're trying to use a constant before it's been defined. Unfortunately my docs in the readme are wrong. I thought I added an entry point where these things could be defined, but I don't see it in the code. Here's a short term workaround you could use
class MyAuthHelper < DerailedBenchmarks::AuthHelpers::Devise
def user
@user ||= begin
User.find_or_create!(email: "[email protected]")
end
end
end
DerailedBenchmarks.auth = MyAuthHelper.new
from derailed_benchmarks.
thanks @schneems , the workaround works ;)
from derailed_benchmarks.
just to let you know that I had to add the method "call" to MyAuthHelper as bellow (I modified the login_as line), or else it would fail with unauthorized request in the app's controllers "before_action: authenticate_user!" from devise.
class MyAuthHelper < DerailedBenchmarks::AuthHelpers::Devise
def user
@user ||= begin
User.find_or_create!(email: "[email protected]")
end
end
# Logs the user in, then call the parent app
def call(env)
login_as(user, scope: :user)
app.call(env)
end
end
DerailedBenchmarks.auth = MyAuthHelper.new
from derailed_benchmarks.
That's weird since it's the exact same code https://github.com/schneems/derailed_benchmarks/blob/c47ef5488bcf2520821b549387476cb889b8afaa/lib/derailed_benchmarks/auth_helpers/devise.rb#L29-L32
Your subclass should have picked that up.
from derailed_benchmarks.
well, it's not exactly the same.. I'm using
login_as(user, scope: :user)
from derailed_benchmarks.
You can now do DerailedBenchmarks.auth.user = -> { User.find_or_create!(email: "[email protected]") }
on the master branch. Are you OK to close this @bitcoder?
from derailed_benchmarks.
Related Issues (20)
- Ruby 3.0 support HOT 1
- DERAILED_SKIP_RAILS_REQUIRES var doesn't seem to work with minimal greenfield application HOT 2
- I don't get this result, seems out of whack HOT 2
- How does this work? HOT 3
- Authentication with sorcery HOT 4
- perf:objects won't boot HOT 2
- ActiveRecord::Migrator.migrate(ActiveRecord::Migrator.migrations_paths, nil) HOT 1
- Standardize formatting with a linter and add a lint check to CI HOT 1
- Fix CI and port to GitHub actions HOT 1
- Fix tests with Ruby 3.1.2 HOT 1
- Stack level too deep HOT 1
- Parsing issues when timing output to log is large HOT 1
- How to run derailed_benchmark's build locally (for contributing) ? HOT 2
- bundle:mem doesn't seem to be deterministic - is this expected? HOT 1
- N+1 Query on UsersController#projects
- Update derailed to depend on syntax_search
- How do I make a request to a endpoint that requires POST?
- SSL connection error: HOT 1
- Compatibility in ruby >=3.2 ? HOT 2
- Blocked host on development environment HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from derailed_benchmarks.