Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@edwardloveall
Last active December 31, 2018 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edwardloveall/fcdb7db98b3467987f39a1e8ac046358 to your computer and use it in GitHub Desktop.
Save edwardloveall/fcdb7db98b3467987f39a1e8ac046358 to your computer and use it in GitHub Desktop.
Lucky Form error
class Follows::Create < BrowserAction
route do
existing_user = UserQuery.new.email(params.get(:email))
if existing_user
FollowForm.create!(from_id: current_user.id, to_id: existing_user.id)
flash.success = "Your invite has been sent to #{existing_user.email} for approval."
redirect to: Follow::New
end
end
end
compiling...
Error in src/server.cr:10: instantiating 'App#listen()'
app.listen
^~~~~~
in src/app.cr:52: instantiating 'HTTP::Server#listen()'
server.listen
^~~~~~
in /usr/local/Cellar/crystal/0.27.0/src/http/server.cr:349: instantiating 'Array(Socket::Server)+#each()'
@sockets.each do |socket|
^~~~
in /usr/local/Cellar/crystal/0.27.0/src/indexable.cr:187: instantiating 'each_index()'
each_index do |i|
^~~~~~~~~~
in /usr/local/Cellar/crystal/0.27.0/src/indexable.cr:187: instantiating 'each_index()'
each_index do |i|
^~~~~~~~~~
in /usr/local/Cellar/crystal/0.27.0/src/http/server.cr:349: instantiating 'Array(Socket::Server)+#each()'
@sockets.each do |socket|
^~~~
in /usr/local/Cellar/crystal/0.27.0/src/http/server.cr:362: expanding macro
spawn handle_client(_io)
^
in macro 'spawn' /usr/local/Cellar/crystal/0.27.0/src/concurrent.cr:97, line 9:
1.
2. ->(
3.
4. __arg0 : typeof(_io),
5.
6.
7. ) {
8. spawn(name: nil) do
> 9. handle_client(
10.
11. __arg0,
12.
13.
14. )
15. end
16.
17. }.call(_io)
18.
19.
instantiating 'handle_client(IO+)'
in /usr/local/Cellar/crystal/0.27.0/src/http/server.cr:396: instantiating 'HTTP::Server::RequestProcessor#process(IO+, IO+)'
@processor.process(io, io)
^~~~~~~
in /usr/local/Cellar/crystal/0.27.0/src/http/server/request_processor.cr:16: instantiating 'process(IO+, IO+, IO::FileDescriptor)'
def process(input, output, error = STDERR)
^
in /usr/local/Cellar/crystal/0.27.0/src/http/server/request_processor.cr:39: instantiating '(HTTP::Handler | Proc(HTTP::Server::Context, Nil))#call(HTTP::Server::Context)'
@handler.call(context)
^~~~
in /usr/local/Cellar/crystal/0.27.0/src/http/server/handlers/compress_handler.cr:12: expanding macro
{% if flag?(:without_zlib) %}
^
in macro 'macro_4768236416' /usr/local/Cellar/crystal/0.27.0/src/http/server/handlers/compress_handler.cr:12, line 12:
1.
2. request_headers = context.request.headers
3.
4. if request_headers.includes_word?("Accept-Encoding", "gzip")
5. context.response.headers["Content-Encoding"] = "gzip"
6. context.response.output = Gzip::Writer.new(context.response.output, sync_close: true)
7. elsif request_headers.includes_word?("Accept-Encoding", "deflate")
8. context.response.headers["Content-Encoding"] = "deflate"
9. context.response.output = Flate::Writer.new(context.response.output, sync_close: true)
10. end
11.
> 12. call_next(context)
13.
instantiating 'call_next(HTTP::Server::Context)'
in /usr/local/Cellar/crystal/0.27.0/src/http/server/handler.cr:24: instantiating '(HTTP::Handler | Proc(HTTP::Server::Context, Nil))#call(HTTP::Server::Context)'
next_handler.call(context)
^~~~
in /usr/local/Cellar/crystal/0.27.0/src/http/server/handlers/error_handler.cr:15: instantiating 'call_next(HTTP::Server::Context)'
call_next(context)
^~~~~~~~~
in /usr/local/Cellar/crystal/0.27.0/src/http/server/handler.cr:24: instantiating '(HTTP::Handler | Proc(HTTP::Server::Context, Nil))#call(HTTP::Server::Context)'
next_handler.call(context)
^~~~
in /usr/local/Cellar/crystal/0.27.0/src/http/server/handlers/log_handler.cr:11: instantiating 'Time.class#measure()'
elapsed = Time.measure { call_next(context) }
^~~~~~~
in /usr/local/Cellar/crystal/0.27.0/src/http/server/handlers/log_handler.cr:11: instantiating 'Time.class#measure()'
elapsed = Time.measure { call_next(context) }
^~~~~~~
in /usr/local/Cellar/crystal/0.27.0/src/http/server/handlers/log_handler.cr:11: instantiating 'call_next(HTTP::Server::Context)'
elapsed = Time.measure { call_next(context) }
^~~~~~~~~
in /usr/local/Cellar/crystal/0.27.0/src/http/server/handler.cr:24: instantiating '(HTTP::Handler | Proc(HTTP::Server::Context, Nil))#call(HTTP::Server::Context)'
next_handler.call(context)
^~~~
in lib/lucky/src/charms/static_file_handler.cr:10: instantiating 'super(HTTP::Server::Context)'
super(context)
^~~~~
in /usr/local/Cellar/crystal/0.27.0/src/http/server/handlers/static_file_handler.cr:29: instantiating 'call_next(HTTP::Server::Context)'
call_next(context)
^~~~~~~~~
in /usr/local/Cellar/crystal/0.27.0/src/http/server/handler.cr:24: instantiating '(HTTP::Handler | Proc(HTTP::Server::Context, Nil))#call(HTTP::Server::Context)'
next_handler.call(context)
^~~~
in /usr/local/Cellar/crystal/0.27.0/src/http/server/handlers/static_file_handler.cr:29: instantiating 'call_next(HTTP::Server::Context)'
call_next(context)
^~~~~~~~~
in /usr/local/Cellar/crystal/0.27.0/src/http/server/handler.cr:24: instantiating '(HTTP::Handler | Proc(HTTP::Server::Context, Nil))#call(HTTP::Server::Context)'
next_handler.call(context)
^~~~
in /usr/local/Cellar/crystal/0.27.0/src/http/server/handlers/websocket_handler.cr:47: instantiating 'call_next(HTTP::Server::Context)'
call_next(context)
^~~~~~~~~
in /usr/local/Cellar/crystal/0.27.0/src/http/server/handler.cr:24: instantiating '(HTTP::Handler | Proc(HTTP::Server::Context, Nil))#call(HTTP::Server::Context)'
next_handler.call(context)
^~~~
in lib/lucky/src/lucky/error_handler.cr:14: instantiating 'call_next(HTTP::Server::Context)'
call_next(context)
^~~~~~~~~
in /usr/local/Cellar/crystal/0.27.0/src/http/server/handler.cr:24: instantiating '(HTTP::Handler | Proc(HTTP::Server::Context, Nil))#call(HTTP::Server::Context)'
next_handler.call(context)
^~~~
in lib/lucky/src/lucky/flash_handler.cr:5: instantiating 'call_next(HTTP::Server::Context)'
call_next(context)
^~~~~~~~~
in /usr/local/Cellar/crystal/0.27.0/src/http/server/handler.cr:24: instantiating '(HTTP::Handler | Proc(HTTP::Server::Context, Nil))#call(HTTP::Server::Context)'
next_handler.call(context)
^~~~
in lib/lucky/src/lucky/force_ssl_handler.cr:33: instantiating 'call_next(HTTP::Server::Context)'
call_next(context)
^~~~~~~~~
in /usr/local/Cellar/crystal/0.27.0/src/http/server/handler.cr:24: instantiating '(HTTP::Handler | Proc(HTTP::Server::Context, Nil))#call(HTTP::Server::Context)'
next_handler.call(context)
^~~~
in lib/lucky/src/lucky/http_method_override_handler.cr:11: instantiating 'call_next(HTTP::Server::Context)'
call_next(context)
^~~~~~~~~
in /usr/local/Cellar/crystal/0.27.0/src/http/server/handler.cr:24: instantiating '(HTTP::Handler | Proc(HTTP::Server::Context, Nil))#call(HTTP::Server::Context)'
next_handler.call(context)
^~~~
in lib/lucky/src/lucky/log_handler.cr:19: instantiating 'call_next(HTTP::Server::Context)'
call_next(context)
^~~~~~~~~
in /usr/local/Cellar/crystal/0.27.0/src/http/server/handler.cr:24: instantiating '(HTTP::Handler | Proc(HTTP::Server::Context, Nil))#call(HTTP::Server::Context)'
next_handler.call(context)
^~~~
in lib/lucky/src/lucky/route_handler.cr:10: instantiating 'Lucky::Action+#perform_action()'
handler.payload.new(context, handler.params).perform_action
^~~~~~~~~~~~~~
in lib/lucky/src/lucky/renderable.cr:84: instantiating 'call()'
response = call
^~~~
in macro 'route' /Users/edwardloveall/Code/edwardloveall/lucky_bits/lib/lucky/src/lucky/routeable.cr:138, line 3:
1. infer_route
2.
> 3. setup_call_method( #<loc:push>begin #<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",3,5>#<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",3,5>#<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",3,5>existing_user = #<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",3,21>#<loc:"/Users/edwardloveall/Code/edwardloveall/luc
> ky_bits/src/actions/follows/create.cr",3,21>#<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",3,21>UserQuery.new.email(#<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",3,41>#<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",3,41>params.get(#<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",3,52>:email))
4. #<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",4,5>if #<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",4,8>existing_user
5. #<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",5,7> #<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",5,7>#<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",5,7>FollowForm.create!(#<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",5,26>from_id: #<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",5,
> 35>#<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",5,35>current_user.id, #<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",5,52>to_id: #<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",5,59>#<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",5,59>existing_user.id)
6. #<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",6,7>#<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",6,7>flash.success = #<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",6,23>"Your invite has been sent to #{#<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",6,55>#<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/
> follows/create.cr",6,55>existing_user.email} for approval."
7. #<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",7,7>redirect(#<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",7,16>to: #<loc:"/Users/edwardloveall/Code/edwardloveall/lucky_bits/src/actions/follows/create.cr",7,20>Follow::New)
8. end
9. end#<loc:pop> )
10.
expanding macro
in macro 'setup_call_method' /Users/edwardloveall/Code/edwardloveall/lucky_bits/lib/lucky/src/lucky/routeable.cr:56, line 10:
1. def call
2. __temp_133 = run_before_callbacks
3.
4. __temp_134 = if __temp_133.is_a?(Lucky::Response)
5. __temp_133
6. else
7. begin
8. existing_user = UserQuery.new.email(params.get(:email))
9. if existing_user
> 10. FollowForm.create!(from_id: current_user.id, to_id: existing_user.id)
11. flash.success = "Your invite has been sent to #{existing_user.email} for approval."
12. redirect(to: Follow::New)
13. end
14. end
15. end
16.
17. __temp_133 = run_after_callbacks
18.
19. if __temp_133.is_a?(Lucky::Response)
20. __temp_133
21. else
22. __temp_134
23. end
24. end
25.
no argument named 'from_id'
Matches are:
- FollowForm.create!(params)
- FollowForm.create!() (trying this one)
- Follow::BaseForm.create!(params, id : Int32 | Nothing = Nothing.new, created_at : Time | Nothing = Nothing.new, updated_at : Time | Nothing = Nothing.new, from_id : Int32 | Nothing = Nothing.new, to_id : Int32 | Nothing = Nothing.new, accepted_at : Time | Nothing | Nil = Nothing.new) (did you mean this one?)
- Follow::BaseForm.create!(id : Int32 | Nothing = Nothing.new, created_at : Time | Nothing = Nothing.new, updated_at : Time | Nothing = Nothing.new, from_id : Int32 | Nothing = Nothing.new, to_id : Int32 | Nothing = Nothing.new, accepted_at : Time | Nothing | Nil = Nothing.new) (did you mean this one?)
class FollowForm < Follow::BaseForm
fillable from_id
fillable to_id
end
class FollowRequestForm < Follow::BaseForm
virtual email : String
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment