luckyframework / website-old

The old website for Lucky (archived)
https://github.com/luckyframework/website-v2
MIT License
11 stars 29 forks source link

Use new Status enum in actions guide #71

Open paulcsmith opened 6 years ago

jwoertink commented 5 years ago

https://github.com/luckyframework/lucky/blob/master/src/lucky/action.cr#L20

What page do you think this should go on? Actions and routing is looking a bit full, but we can probably squeeze it in?

paulcsmith commented 5 years ago

I was thinking anywhere we use the status enum we replace it with a symbol. So no new sections required.

json something, : :ok

Instead of

json something, Status::Ok

jwoertink commented 5 years ago

oh, I see what you're saying. Cool.

jwoertink commented 5 years ago

Ok, so we're not actually using the enum anywhere in the docs. Every mention of status uses the Int32 representation..

And on a side note, using a symbol doesn't actually work..


    redirect to: "https://google.com", status: :moved_permanently
    ^~~~~~~~

in lib/lucky/src/lucky/redirectable.cr:54: no overload matches 'HTTP::Server::Response#status_code=' with type Symbol
Overloads are:
 - HTTP::Server::Response#status_code=(status_code : Int32)

    context.response.status_code = status
                     ^~~~~~~~~~~

I can file this as a bug, or I can add mention of how to use the enum constant, or we can just close this one out since there's not really anything to update.

paulcsmith commented 5 years ago

On the go so can’t totally respond but I’d say that’s a bug in Lucky. We should be able to use the enum for redirects.

The main spot these are used is in json apis. There may be some spots there that can use the symbol version of the enums

On Mar 15, 2019, at 6:59 PM, Jeremy Woertink notifications@github.com wrote:

Ok, so we're not actually using the enum anywhere in the docs. Every mention of status uses the Int32 representation..

And on a side note, using a symbol doesn't actually work..

redirect to: "https://google.com", status: :moved_permanently
^~~~~~~~

in lib/lucky/src/lucky/redirectable.cr:54: no overload matches 'HTTP::Server::Response#status_code=' with type Symbol Overloads are:

  • HTTP::Server::Response#status_code=(status_code : Int32)

    context.response.status_code = status ^~~ I can file this as a bug, or I can add mention of how to use the enum constant, or we can just close this one out since there's not really anything to update.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.