by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Paul Smith
    @paulcsmith
    You’d have to pass in lucky_params: params from the action, but that should almost certainly work as a workaround! Lmk if that helps/works @rnice01
    KC Erb
    @KCErb
    For those interested, new release of the Lucky + GraphQL tool: https://github.com/KCErb/lucky-hasura-docker/blob/master/CHANGELOG.md. :)
    Edward Loveall
    @edwardloveall
    congrats @KCErb!
    Rob
    @rnice01
    @paulcsmith params.as(Lucky::Params).get_file worked, thanks for that!
    Paul Smith
    @paulcsmith
    You’re welcome!
    Bruce Perens K6BP wants YOU to social distance.
    @BrucePerens_twitter

    That’s a bug. Could you open an issue?

    Yes. Thank you.

    Bruce Perens K6BP wants YOU to social distance.
    @BrucePerens_twitter
    I am having an interesting time writing a validator involving a polymorphic association. I tried to write a query like this:
    PageQuery.new.preload_parent.id.nilable_eq(parent.value)
    Where parent is polymorphic. preload_parent.id works, but is there a way to get something like parent_id instead?
    Also, I can't find any field in the save operation that corresponds to parent, so parent.value doesn't work.
    Ignore nilable_eq, this association is not optional.
    Bruce Perens K6BP wants YOU to social distance.
    @BrucePerens_twitter
    I got this to compile, but it's not nice code because it enumerates all of the polymorphic types. In this case there are only two, but there could be more.
    query = ProductQuery.new.preload_parent.id.nilable_eq(manufacturer_id.value || product_id.value).name.nilable_eq(name.value)
    Also, the result of manufacturer_id.value || product_id.value is nilable, but the association is not optional.
    Jeremy Woertink
    @jwoertink
    So this is in an Operation where parent, manufacturer, and product_id are attribute or from the model?
    Do you have an example of the SQL you're looking to generate?
    Bruce Perens K6BP wants YOU to social distance.
    @BrucePerens_twitter
    parent is a polymorphic association of manufacturer_id or product_id. manufacturer_id and product_id are model fields, and I think you call them params in the save operation. What I want is to getparent to macro expand to manufacturer_id or product_id depending on the polymorphic type. And that is both in the model fields and the save operation params. In this case the number of polymorphic types is just 2, but in another case it's 7.
    I am not really clear what the SQL should look like, as I haven't examined what a polymorphic uh, attribute becomes in SQL.
    Jeremy Woertink
    @jwoertink
    Ok, I think I see what you're doing now.
    I'm not too sure on how to best do that though
    I'll need to think about that one a bit
    Bruce Perens K6BP wants YOU to social distance.
    @BrucePerens_twitter
    Also came up with this today: luckyframework/avram#374
    Jeremy Woertink
    @jwoertink
    :thumbsup: Thanks for adding these issues in. Hope we can come up with some solutions for those
    Bruce Perens K6BP wants YOU to social distance.
    @BrucePerens_twitter
    You're welcome. Thanks for working on Lucky!
    Matthew McMillan
    @UnsolvedCypher_gitlab
    Is there a simple way to set the host/port for a compiled Lucky app? I've tried setting the HOST environment variable but that doesn't seem to do anything
    Edward Loveall
    @edwardloveall
    there's a PORT environment variable that lucky picks up on
    Matthew McMillan
    @UnsolvedCypher_gitlab
    does that need to be set at compile time?
    Edward Loveall
    @edwardloveall
    similarly, you could use a HOST varible if you set it up in config/server.cr
    I'm not sure
    easy to test though
    i'll try it
    Matthew McMillan
    @UnsolvedCypher_gitlab
    Alright, I'll give it a try
    Edward Loveall
    @edwardloveall
    it does work
    you have to do something like this to test
    SECRET_KEY_BASE=xxxxxx LUCKY_ENV=production DATABASE_URL=postgresql://@127.0.0.1/<app>_development SEND_GRID_KEY=unused APP_DOMAIN=localhost PORT=1234 ./start_server
    you'll need an actual secret key (or some 32 character string) from lucky gen.secret_key
    Matthew McMillan
    @UnsolvedCypher_gitlab
    Oh I see, so you have to set all of the environment variables and it can't just be one?
    Edward Loveall
    @edwardloveall
    yes, but they don't all have to be set inline
    if you do something like export LUCKY_ENV=production
    then in that session, the LUCKY_ENV environment variable will be set and the app will pick it up
    Matthew McMillan
    @UnsolvedCypher_gitlab
    Ok that's very helpful, thank you :)
    Edward Loveall
    @edwardloveall
    those go away if you start a new terminal though
    or new SSH session or what have you
    you're welcome!
    Jeremy Woertink
    @jwoertink
    You can put those in to your .env and just make sure that file exists in your production
    When I do my deploy, I copy .env.production to .env
    Matthew McMillan
    @UnsolvedCypher_gitlab
    That is a good idea, thank you
    I'm getting the following error: Unhandled exception: Unexpected error while running migrations: no driver was registered for the schema "", did you maybe forget to require the database driver? - has anyone seen this before? Things seem to be working fine in dev but not in production
    Matthew McMillan
    @UnsolvedCypher_gitlab
    My bad- I was using the wrong database URl
    *URL
    Jeremy Woertink
    @jwoertink
    👍