Lucky v0.24 is out. A few new features, bug fixes, improved performance, and more!
Lucky v0.24 is out now and updated to work with Crystal v0.35.1
See the UPGRADE_NOTES.
Or you can view the changes using LuckyDiff. This tool helps see what has changed between versions and will be included in upgrade notes from now on.
Ok, so sometimes you get a great idea, and try it out, and then later realize maybe it wasn’t the best 😅.
When we changed
mount to be
m, we also changed the signature which paves the way for some pretty neat
future updates we have planned.
We realized that
m is hard to search for, and it’s a little confusing to newcomers, so we’ve reverted the
name back to
mount; however, we kept the same signature.
# in Lucky 0.23 m Shared::Footer, year: 2020 # in Lucky 0.24 mount Shared::Footer, year: 2020
A simple rename, and you’re good to go!
Your Action classes will always return some response whether it’s
json() for your API,
html() for your browser apps. Now we have
data() which can be used for responding with
the contents of a file or other data.
For anyone familiar with using Ruby on Rails, this is similar to the Rails
class Reports::Show < BrowserAction get "/reports/:id" do info = gather_data(id) data(info, disposition: "inline") end end
View the PR for more context.
In Lucky 0.23.0 we added the
redirect_back method to redirect a user back to the referer or a specified
fallback path. In this version, we’ve disallowed redirecting back to external hosts unless you specify.
redirect_back fallback: Home::Index, allow_external: true
When configuring your database in
config/database.cr, you would set your URL string, or
pass a few options to
PostgresURL. We’ve renamed this to
Avram::Credentials which allows us
to validate your connection string at compile time.
Before this release, you could have this:
# in config/database.cr settings.url = Avram::PostgresURL.build( #... username: `whoami` )
Doing this would cause your username to be set as
"myuser " which could lead to some issues.
Now we can catch that, and have a better structure for adding future validations as other edge cases arise.
# in config/database.cr settings.credentials = Avram::Credentials.new( #... username: "myuser" )
Along with the better safety, we also now have a standard for apps to use that don’t need to connect to a database. (Like this website).
# in config/database.cr settings.credentials = Avram::Credentials.void
When you’re writing your tests, you’ll use Boxes as factories for your models. In this release,
we’ve added in a method to return a
NamedTuple of the attributes without creating a new record.
class AdminBox < BaseBox def initialize name "Admin" end end admin_attrs = AdminBox.build_attributes admin_attrs[:name] == "Admin"
Starting with this release, we’ve decided to move our community forum over to Discord. This was by no means a quick decision, and has been in the works with the core team for quite some time. To clarify a few of our reasons for choosing an alternate platform:
We understand this is a big change, so please bear with us while we give this a test.
There’s plenty more updates in this release, so go and try them out! we appreciate all the support everyone has shown helping to make each release better and better. We’re really excited about getting closer to a 1.0 release!
Please give it a spin and help us find bugs so our next release is even more solid. If you find any issues, don’t hesitate to report the issue. If you’re unsure, just hop on Discord chat so we can help you out.
Thanks so much for the support!
For questions, or just to chat, come say hi on Discord.