nickjj

Activity Graph

Page 1 of 13 | Next »

2019-06-19

[12:58:56] nickjj: i'm reading that you really shouldn't query your db in a custom validator, but what pattern would you use if you want to throw a validation error if a db result isn't returned back from performing a query?
[12:59:44] nickjj: the use case is i'm looking up eligible discounts and i want to render a legit ecto validation form error of "did not match any active discounts" -- but the only way i'm able to pull this off is by querying the DB inside of the custom validator
[13:05:51] nickjj: benwilson512, the implementation looks like this at the moment https://gist.github.com/nickjj/8332607de12a3ae473af11b09175b6b5
[13:07:36] nickjj: this changeset is in relation to returning 0 or more coupons -- think about a user entering a discount code in a form and being either presented with an active discount (eligible) or non-active discount (not eligible)
[13:07:46] nickjj: well, technically 0 or 1 discounts
[13:08:21] nickjj: that's why i wanted the 0 case to be handled inside of the validator, so i can show a form error next to the text field where they entered the code
[13:11:24] nickjj: i guess i'm just missing the link where i can pass the "ahead of time query" into a validator
[13:12:25] nickjj: i could see maybe running the eligible query before the changeset and returning back a normalized list of discount codes like ["foo", "bar", "bar"] but how would i pass that list into validate_inclusion so i can continue providing the user feedback if it fails?
[13:17:08] nickjj: ericmj, something like this? https://gist.github.com/nickjj/aca8cadd5ed2aa3725e386f875be3ab6 , but a race condition could technically happen here right?
[13:18:39] nickjj: benwilson512, thanks. in this case that changeset is part of a checkout embedded schema
[13:19:15] nickjj: actually sorry, i meant an apply discount embedded schema
[13:19:39] nickjj: the race condition is interesting tho, i guess i'll have to live with it
[13:21:01] nickjj: thanks, i do think this a bit cleaner in the end, and makes testing potentially easier
[13:21:32] nickjj: ericmj, what code are you interested in seeing to determine that?
[13:25:02] nickjj: ericmj, these are the related schemas https://gist.github.com/nickjj/f982d94f073462e56b516d01581491b9
[13:25:15] nickjj: and the other gist has the main query being used
[13:26:52] nickjj: so eligibility is really a combination of 2 things, making sure it's available for a specific package (discount_packages table) but also the code itself has a bunch of rules (discounts table) like max redemptions and date based expiration (which i omit from the schema for brevity)
[13:29:51] nickjj: at the point of determining its eligibility? that's correct , it's just going to be a bunch of where conditions to make sure they are not expired
[13:30:27] nickjj: yeah typically a discount would be created and then not touched, and then soft deleted when it expires
[13:31:34] nickjj: but the race condition could be 1. discount is determined to be eligible , 2. changeset passes but in between 1 and 2 someone uses the last available discount
[13:31:59] nickjj: or the system time pushes it 1 second past the expiration date
[19:52:03] nickjj: does anyone know how to select specific fields from a joined table with ecto? hit a brick wall and i can't find a solution googling -- here's the query + current results + what i'm trying to get back https://gist.github.com/nickjj/9a46edc4c4d5c08b5769eb139a2feaab
[19:52:22] nickjj: i tried a whole bunch of different combinations of using select in the query, but nothing worked
[19:54:42] nickjj: the closest i can come up with is [{"HELLO"}] as the output which isn't quite ["HELLO"]
[19:56:37] nickjj: foggyboi, using select: d.code , ended up working as long as i removed the preloads
[19:56:59] nickjj: a few examples i saw had things like , select: {d.code} , i thought the {} was necessary
[19:59:22] nickjj: foggyboi, do you happen to know if it's possible to situationally do that select/preload based on a condition being true or not?
[19:59:36] nickjj: for example, to avoid doing this: https://gist.github.com/nickjj/2930786c8b0a90852b8ee2be08c2dccc
[20:00:08] nickjj: i haven't quite figured out how to connect the dots on reusing queries
[20:01:58] nickjj: warmwaffles, in this case it's more than just preloading or not -- it's either selecting just the codes and not preloading or selecting everything and preloading
[20:08:35] nickjj: would that same strategy apply for selecting just the code or not too?
[20:08:51] nickjj: basically another function to replace the the `select: d.code,` line in your comment
[20:11:08] nickjj: yeah that's what i would like to do eventually, still figuring out how to compose them nicely
[20:16:49] nickjj: but your comment really helped to see how maybe i can extract some of that into reusable queries (didn't get a solution for my question, but at least was able to refactor a few things) -- thanks!
[20:23:00] nickjj: warmwaffles, something like this is working so far , would you say this is idiomatic usage of query composing? https://gist.github.com/nickjj/1883599c9e598ffe24feb97542971973
[20:23:40] nickjj: my naming conventions aren't the best yet, but it is functional in the sense it produces 1 query with the correct results based on what L35's arguments are
[20:33:24] nickjj: do you happen to have an example of how to compose a query where you want to access the joined field, without having to explicitly do the join again?
[20:36:15] nickjj: with the gist, if i look at the raw sql, it's doing an INNER JOIN 3 times
[20:36:42] nickjj: i left a comment with the query
[20:37:27] nickjj: now, i did see another example online from 2015 where someone did: query |> where([c], c.votes > 10)
[20:37:55] nickjj: and prior to using that query, they did the join in another query
[20:38:05] nickjj: check the bottom of this post https://blog.drewolson.org/composable-queries-ecto
[20:38:47] nickjj: this is doing exactly what i'm trying to do with a join -- but when i try it, elixir won't even compile with this error: unbound variable `d` in query. If you are attempting to interpolate a value, use ^var
[20:39:04] nickjj: that was with doing: where(query, [d], d.code == ^String.upcase(code))
[20:39:13] nickjj: yes, that is what i tried to emulate on my end
[20:39:50] nickjj: in his final example he first joins the post with the comment and then does popular on it
[20:42:12] nickjj: yes, because if i try to preload it when doing the select, then ecto throws an error
[20:47:52] nickjj: warmwaffles, i got it -- it only produces 1 inner join now, and it's still composable
[20:48:20] nickjj: the syntax was this: from([_q, d] in query, select: d.code)

2019-06-18

[21:21:15] nickjj: does anyone have any advice on performing a bunch of changeset related tests? what i'm doing in this gist works well enough but i wonder if i'm missing any type of obvious wins here to make this more DRY while still being clear -- ultimately i will end up having like 10 similar'ish tests https://gist.github.com/nickjj/e9dcadff38ba5f66c9ff58414ef147ae
[21:21:50] nickjj: for reference L1 just generates a map with a bunch of invalid attributes
[21:47:46] nickjj: benwilson512, so you'd likely stick with that set up in the gist?
[21:48:51] nickjj: i do agree on not getting cute with tests, they should show how to implement something clearly -- i just see a lot of boilerplate potentially coming up

2019-06-17

[10:51:20] nickjj: serafeim, you could always write your own function with the fragment too
[10:51:43] nickjj: and then use that in your contexts or wherever, this way your outer most api is nice and clean
[10:57:08] nickjj: i do wonder if ecto will end up with more convenience functions in the future tho
[10:58:39] nickjj: i work with sqlalchemy a lot too, it has some nice little things like between() for comparing 2 date ranges
[14:28:09] nickjj: on the topic of ecto fragments, generally speaking do you think you'd reach for using them vs using elixir to manipulate the data before it gets to the db? such as using String.downcase() vs using a LOWER() fragment
[14:31:21] nickjj: micmus, this would be mainly for doing lookups (such as doing a get_by) where the user input is coming from a url param and it's case sensitive
[14:31:44] nickjj: in this case, on write, i'm normalizing everything at the changeset level by making them all uppercase
[15:41:49] nickjj: is there a less horrible way of trying to generate groups of random letters+numbers? https://gist.github.com/nickjj/855e5e5141f2e037a5bd9e7dc6ff3f87
[15:45:03] nickjj: OliverMT, does UUId.generate allow you to pick when the - happens and also whitelist your own charset?
[15:45:32] nickjj: dysfun, i did in the gist, but it feels like i'm doing it so poorly
[15:46:19] nickjj: i'm not encoding anything by the way, i'm generating discount codes
[15:46:32] nickjj: random ones hopefully, but if they are not unique, that will be handled elsewhere
[15:47:11] nickjj: precomputing wouldn't be an issue here , they will all be whitelisted and validated before use
[15:47:52] nickjj: it's just a matter of generating a random XXXX-XXXX-XXXX-XXXX sequence with a custom charset
[15:50:52] nickjj: base32 is pretty close, but it still makes me unhappy in some cases
[15:52:37] nickjj: there's too many characters that look similar in base32, like S and 5 and skipping 0 still means O is available but at a glance O can be confused for O or 0 (the user still needs to make the decision)
[15:55:08] nickjj: i'm also going to be generating up to 5,000 at these at a time, so this is one case where performance might matter
[15:59:16] nickjj: ok thanks
[16:04:16] nickjj: yeah i guess it doesn't matter, i just benchmarked it and on my dev box it finished in 730ms to generate 5,000 of them
[16:04:33] nickjj: which is a 5 year old i5 3.2ghz
[16:10:49] nickjj: but then again using erlang's crypto package combined with Base.encode32 takes 20ms to generate 5,000 codes too, but it's not formatted how i want
[19:36:24] nickjj: has anyone ever encountered a situation where ecto will throw constraint errors at you, even if you have validations in place to protect against it?
[19:37:07] nickjj: for example i have a constraint to make sure a string <= 19 chars in length but i also have an ecto validate_length(:foo, max: 19) in place -- but ecto never runs that validate_length to give me a warning
[19:37:36] nickjj: it only happens on insert too, like actually wanting to write to the db
[19:38:58] nickjj: i've been stuck on this for about an hour, googling to the end of the universe, nothing is coming up but i don't understand why validate_length isn't being run
[19:41:38] nickjj: benwilson512, jnoon21 this is what i'm doing https://gist.github.com/nickjj/2a2d86ce40dea70d5574bc63274accf3
[19:42:20] nickjj: and @valid_attrs in this case is a Discount struct
[19:44:07] nickjj: benwilson512, refresh the gist, i added the full / entire / real discount struct -- this is what happens when i IO.inspect(@valid_attrs)
[19:45:38] nickjj: it's there now (full stack trace) -- reload again
[19:46:18] nickjj: the tricky thing is the stack trace doesn't point to anything in my code base
[19:46:32] nickjj: i mean sure it points to the test calling the code, but that doesn't help
[19:46:44] nickjj: yes, it being 19 chars is expected
[19:47:16] nickjj: validate_length 19 should in theory allow the maximum right? in other words it should allow a 19 char discount code?
[19:48:18] nickjj: reload the gist, i added the db details based on a migration
[19:48:24] nickjj: i trimmed out the non-code fields to make it more readable
[19:48:49] nickjj: so there is a constraint in place, but it should allow <= 19 chars
[19:49:53] nickjj: and if i check psql , that migration is active because it reports back: "code_length" CHECK (char_length(code) <= 19)
[19:50:11] nickjj: how do i set a debug log level?
[19:50:41] nickjj: when i run the test, i do get the constraint error at the db level coming up in the terminal (ie. the row failure) -- but this is pure sql
[19:52:29] nickjj: benwilson512, reload the gist , the "e" file has the query based on setting the logger to debug
[19:52:52] nickjj: i'm still counting 19 chars there (4 groups of 4 chars with 3 hyphens)
[19:53:52] nickjj: also if you reload again, i added even more details to "e" (which is the sql error straight from pg)
[19:55:39] nickjj: the killer thing is if i drop into iex and run Billing.create_discount(foo) and fill up foo with a code of AAAA-AAAA-AAAA-AAAA it works
[20:00:20] nickjj: benwilson512, for example check this out https://gist.github.com/nickjj/5960b49fd6f0be7a52278ab7fdbe0208 -- these are all expected results when i run it in iex
[20:05:08] nickjj: damn, that was it
[20:05:40] nickjj: i connected to my dev db, i just connected to the db and my code length constraint is 18 chars (i had recently bumped it to 19)
[20:05:56] nickjj: *just connected to the test db
[20:07:03] nickjj: what was driving me insane was, i had nearly identical code on a different struct with passing tests (same type of constraint / validate_length and it was all working)
[20:07:25] nickjj: but i had since completely blew out my db since then, so it had an up to date schema
[20:13:07] nickjj: thanks a lot, it's all working now -- i need to remember ecto.reset won't apply to your test db unless you call it with MIX_ENV=test

2019-06-16

[18:52:04] nickjj: earlier i watched a talk on using genstage to build a consumer and producer to handle tracking video progress, and it dealt with back pressure, etc.
[18:52:19] nickjj: it was all self contained without using rabbitmq or anything else
[18:52:38] nickjj: that talk was like 2 years ago, nowadays would you use broadway for this?
[18:54:54] nickjj: ultimately that tracking info is being written to postgres but they used that genstage set up to make sure the db didn't get crushed

2019-06-15

[00:00:10] nickjj: if you had a scenario where you had an optional string field in a DB, and you wanted to set a default string for it (but it might change a few times), would you set a proper DB-level default or just do a myschema.foo_label || "the sane default" in the 1 spot where you use it?
[00:00:32] nickjj: it's literally called in 1 spot (in an eex template)
[14:40:37] nickjj: Read error: Connection reset by peer

2019-06-14

[00:07:30] nickjj: nageV, the only complaint i have with the talk is he wasn't allowed to talk for another hour
[09:13:09] nickjj: serafeim, there's ALT+left and ALT+right to go back and forward
[09:16:05] nickjj: that's what the alt shortcuts do
[09:17:27] nickjj: 1. look / edit file A on line 5 , 2. open a new file B (same tab or not doesn't matter) , 3. ensure focus is on file B , 4. hit alt+left , 5. now you're back in file A on line 5 (edit isn't cared about, A was your last viewed file)
[10:41:33] nickjj: can anyone explain why this with statement always tries to execute the happy case? https://gist.github.com/nickjj/e91f519c05f8602639143576ed2d4db2
[10:42:11] nickjj: even if i supply a checkout_package_id that doesn't exist (which returns nil), line 8 doesn't trigger
[10:42:32] nickjj: if i replace "XMLHttpRequest" with "foobar" , L5 also doesn't trigger
[10:44:09] nickjj: the xhr one can be true or false , and the package lookup can be a package or nil
[10:44:16] nickjj: i was trying to use with to eliminate some nested conditionals
[10:44:36] nickjj: because the xhr check is the outer most conditional
[10:45:53] nickjj: would it be `true` or `_true` if i plan not to use the "true" value anywhere?
[10:47:57] nickjj: am i using with correctly in this case to eliminate nested conditionals?
[10:48:22] nickjj: how would you write things? previously i had nested if statements
[10:49:02] nickjj: this is for a phoenix controller action btw
[10:49:36] nickjj: what do you mean? it needs to be accessible as a controller action
[10:49:55] nickjj: i don't think it will let me match on database queries in the function head
[10:50:19] nickjj: Nicd-, what are tags?
[10:54:32] nickjj: Nicd-, is all of that worth doing to avoid nesting ifs?
[10:55:24] nickjj: it's only 2 , where the fail case of the if is a 1 liner
[10:57:53] nickjj: Nicd-, does your get_by_secret function use Repo.get_by under the hood or something else that returns a tuple response?
[10:58:21] nickjj: wait the code is here, i can look that up :D
[11:00:12] nickjj: ah i see, the :not_found and other things you put there are for the json statuses
[12:36:34] nickjj: siwatpru, are you running into issues where passing the prefix around is a problem?
[12:36:49] nickjj: just asking because i was looking at that package too once i move this app into using multi-tenants
[12:45:00] nickjj: it seems to have a plug too which does a put_tenant , does that not apply the prefix somehow? i haven't tried the lib yet personally
[12:49:53] nickjj: ah nm, that seems to just give you the prefix to set (by subdomain), not set the prefix itself
[12:58:45] nickjj: i get it tho, having looked at the package in more detail, if you need to scope every Repo call with the prefix, from a code standpoint that's not too much different than having a tenant_id in every query (in the sense you need to remember to set it for every single query)
[13:02:30] nickjj: yeah it's why better than a tenant_id, but i mean it's something you need to manually manage at every query (by adding the prefix)
[13:02:33] nickjj: *way better
[13:22:30] nickjj: siwatpru, would you end up setting Ecto.put_meta in a plug, assuming your tenants change by subdomains
[16:16:03] nickjj: speaking of changesets, what causes you having to do explicitly call changeset = %{changeset | action: :update} , to get changeset validation errors to appear?
[16:16:36] nickjj: i have to do that on a few of my forms, but i haven't figured out the pattern yet , other than in the cases where i need to do it, i'm not trying to write the changeset to the db
[17:59:28] nickjj: Ping timeout: 248 seconds

2019-06-13

[04:29:01] nickjj: Read error: Connection reset by peer
[10:43:08] nickjj: has joined #elixir-lang
[20:06:46] nickjj: stupid question here, but i think it finally clicked on why the beam is so useful (based on a talk i saw the other day), in the non-beam world if you have an app server running and a bad actor does something bad that pegs your CPU or kills i/o, the only escape there is to kill your app server which kills it for everyone
[20:07:20] nickjj: but in elixir land, if that same scenario happens, you can pop open the observed and kill the single process (ie. web request) being a jerk and everyone else is unaffected?
[20:07:29] nickjj: *observer
[20:49:48] nickjj: gamache, i haven't been sitting here pondering that for the last few weeks while building this app but for whatever reason today my brain was like "hey, that's a really good thing and other stacks you've worked with don't offer that"
[21:54:32] nickjj: benwilson512, yeah that was one of the best talks on the subject IMO

2019-06-12

[12:09:07] nickjj: why does Repo.insert's upsert functionality also modify the inserted_at time by default?
[12:15:08] nickjj: ericmj, for now i was just reading the docs but i did plan to do that yeah
[12:15:22] nickjj: because the alternative seems to be having to whitelist every column except inserted_at
[12:15:58] nickjj: but i'm having difficulty thinking of a use case where if a conflict happened and an update occurred, you would want the inserted_at to be modified
[12:18:15] nickjj: right, :replace_all_except_inserted_at is what i'm after
[12:18:31] nickjj: guess i'll bite the bullet and whitelist every column - inserted_at
[12:20:13] nickjj: -- is a shortcut for removing a key from a map?
[12:21:55] nickjj: ah, i just played with it in iex, i didn't know __schema__ returned a list
[12:21:58] nickjj: cool, thanks
[20:03:01] nickjj: Ping timeout: 252 seconds
[20:17:02] nickjj: has joined #elixir-lang
[22:43:45] nickjj: can someone help me reverse something from the hex.pm source code?
[22:44:09] nickjj: if you check out the creation action in the login controller at https://github.com/hexpm/hexpm/blob/master/lib/hexpm_web/controllers/login_controller.ex#L14
[22:44:23] nickjj: it pattern matches on the username and password -- pretty standard so far
[22:45:08] nickjj: but if you goto https://hex.pm/login , inspect the username element , delete it and submit the form with no username field , technically there should be no username in the params but that create action still matches it and throws a 400 -- how is that happening?
[22:45:52] nickjj: i would have anticipated an error 500 to be thrown because no pattern was matched
[22:46:47] nickjj: i have a feeling a generic 400 is being thrown from somewhere else but i can't figure out where or how
[22:49:56] nickjj: ah, so as long as you have a generic 400 set up in your error handlers, you're good to go?
[22:53:08] nickjj: something to explicitly handle that in a phoenix ErrorView
[22:56:42] nickjj: thanks, that's really perfect then -- i almost went down a very bad path
[22:57:28] nickjj: i mean, with that 400 catch in place, you could aggressively pattern match on map elements in your actions and if people try to mess around with your HTML by removing stuff, it's all handled in 1 spot with a sane default generic response

2019-06-10

[15:22:41] nickjj: Ping timeout: 268 seconds
[22:05:43] nickjj: how do you guys deal with pattern patterning specific map attributes for certain routes that expect POST data? do you end up creating a bunch of secondary patterns to account for bad actors who may remove form fields which would cause a non-match? that's what i'm thinking but it seems super verbose to have to do this for every single combo of missing attributes for every non-GET request
[22:10:48] nickjj: a concrete example is this: https://gist.github.com/nickjj/1fea10448743f6a4b35503cb329c8283 , if someone tries to be cute and deletes the apply_discount_code input field and submits the form then elixir (rightfully) throws an error that it can't find a match

2019-06-09

[13:01:58] nickjj: hypercore, depends. at a first glance that seems ok, but i'd also think about what a notification means in the specific case of your app
[13:02:26] nickjj: for example, in some cases, maybe emailing people the notification could work, and you avoid the db
[23:57:40] nickjj: wow i'm impressed by the compiler's warnings on being able to detect if a pattern always matches

2019-06-08

[09:06:43] nickjj: Ping timeout: 245 seconds

2019-06-06

[14:52:48] nickjj: Ping timeout: 248 seconds

2019-06-04

[11:43:13] nickjj: Read error: Connection reset by peer
[17:04:10] nickjj: Read error: Connection reset by peer
[17:04:34] nickjj: has joined #elixir-lang
[18:23:23] nickjj: Ping timeout: 248 seconds

2019-06-03

[18:04:54] nickjj: hypercore, depends on the use case. do you want your users to be logged out if you restart your app? i would think for most web apps / services the answer to that is no
[18:06:25] nickjj: there was a period of time where i kept getting logged out of netflix (almost every day) on my TV and i had to type a 30 char password with a remote to login, it was enough to consider cancelling my subscription
[18:07:04] nickjj: benwilson512, yeah that's where i persist mine
[18:13:02] nickjj: are you visiting your site on localhost or an IP address?
[18:20:37] nickjj: probably wouldn't hurt to write / read a cookie manually to, just to make sure that's all working
[18:30:30] nickjj: Read error: Connection reset by peer
[18:59:01] nickjj: has joined #elixir-lang
[20:20:19] nickjj: is there any type of trick to get a radio button's label to use both the field name and value as its id?
[20:21:10] nickjj: situation is if you have 2 radio buttons for :foo , and you define them using phoenix's tags , then the label will end up being the same for both radio buttons (which is an invalid state)
[20:21:28] nickjj: the hack i'm doing for now is hard coding for: "foo_0" where 0 is one of the radio's values and foo_1 for the other
[23:29:32] nickjj: Read error: Connection reset by peer
[23:30:53] nickjj: has joined #elixir-lang

2019-06-02

[14:32:29] nickjj: what would the syntax be to render() a partial template where you pass both the "assigns" and a custom variable to the partial? i tried so many combinations and i don't see an example of this in the docs
[14:32:55] nickjj: i'm just trying to render a partial that happens to include a form field from the template which is rendering the partial
[14:33:19] nickjj: so my goal is to provide that included (partial) template access to "f" as well as any assigned vars from the controller
[14:35:11] nickjj: Ankhers, what do you mean?
[14:35:51] nickjj: in this case, it's an "f" (form) object from the template, i don't think that can be passed in from the controller because it's not defined at that point yet
[14:37:01] nickjj: render(HelloWeb.FooView, "_hello.html", f: f, assigns) , that is the end effect i'm trying to do , this way i can access @f in the partial -- but that's invalid syntax
[14:37:22] nickjj: or even better, if there's some way to just make f accessible in partial without @f that would be super
[14:37:35] nickjj: yeah that doesn't seem to work if your render function includes "assigns"
[14:37:44] nickjj: you'll get a compile error saying invalid syntax
[14:39:17] nickjj: how would i modify that assigns in the render() call to include f?
[14:40:37] nickjj: that throws no function clause matching in Keyword.put/3
[14:41:49] nickjj: https://gist.github.com/nickjj/cc569557cc2f1b93288364d40341ede4
[14:42:06] nickjj: i marked the line with !!!!! where the line error came from
[14:42:27] nickjj: since in the browser, you can't copy line numbers
[14:43:46] nickjj: that is where the error is ending up, based on calling a render function in the template using the syntax you recommended -- ie. <%= render(HelloWeb.CheckoutView, "_pricing.html", Keyword.put(assigns, :f, f)) %>
[14:45:03] nickjj: assigns is what phoenix provides i think
[14:46:33] nickjj: it's very hard to copy code out of a phoenix stack trace in a browser, since you can't copy everything
[14:47:31] nickjj: do you need me to link to phoenix's source code for parts of the trace?
[14:49:32] nickjj: thanks, that compiles, but when phoenix throws a 500 saying @f is not available in the eex template (i also tried f without the @ and then it says f is undefined)
[14:49:42] nickjj: *but then
[14:50:04] nickjj: the exact error is `** (ArgumentError) assign @f not available in eex template.`
[14:50:42] nickjj: so it seems that from that template's POV, the modification of assigns never happened
[14:52:44] nickjj: can you show me an example of working code on your end?
[14:53:44] nickjj: in the context of phoenix, when rendering a partial template to include a modified "assigns" with a custom value so that the partial template has access to it without errors
[14:55:24] nickjj: what if you change @conn.assigns to assigns?
[14:57:02] nickjj: because if i use @conn.assigns, then i get a different error in my partial template because it's using @conn (to set a foo_path url)
[14:58:54] nickjj: yeah no dice here, with assigns, everything is for sure saved, reloaded, etc.
[14:59:26] nickjj: the only thing worth mentioning is i'm rendering a response without a layout, but i don't think that would change the outcome
[15:10:53] nickjj: Ankhers, i don't have the full project up, but here's a minimal example that reproduces the error https://gist.github.com/nickjj/af81220ae270fe9fc80584bc53eddc40
[15:11:38] nickjj: and in that new.html.eex file, f is being provided from a standard phoenix form_for function
[15:15:28] nickjj: yes, i would be accessing 4 variables that i pass in through my controller as well as accessing @conn
[15:16:18] nickjj: i also tried the "no way this is right but might work" approach of just hard coding every single assigns variable manually (including low level things like view_module, etc. based on what the elixir error told me) but that also didn't work in the end
[15:16:32] nickjj: and in the above way, that meant also removing assigns from the render call
[15:21:31] nickjj: i think the bit about the layout not being sent over is important because the form page renders, it's just when i submit it, it becomes a problem
[15:48:35] nickjj: i think i see what happened. the form is defined outside of the partial
[15:49:43] nickjj: so if the controller just responds with the partial and nothing else, i don't think the form object is available in the partial that is using it
[15:50:18] nickjj: kind of a bummer but i guess expected, because i def. don't want the form_form to be included in the partial
[15:50:26] nickjj: *form_for
[21:51:30] nickjj: Read error: Connection reset by peer
[21:55:14] nickjj: wonder if it's related to google cloud's outages

2019-05-31

[00:06:03] nickjj: can someone explain how it's even possible for code to compile if a variable doesn't exist? i was super surprised by a warning elixir just told me
[00:06:17] nickjj: which was: 'warning: variable "foo_params" does not exist and is being expanded to "foo_params()", please use parentheses to remove the ambiguity or change the variable name
[00:07:09] nickjj: it was in a case where i referenced foo_params as an argument to a function (expecting foo_params existed beforehand, but it didn't due to a copy / paste mistake) but i would have expected the program to not be able to compile in that case

2019-05-30

[20:19:11] nickjj: and then add in the new releases.exs config file to take its place -- but perhaps that doesn't even need to be imported anywhere in a phoenix app?
[20:19:32] nickjj: since elixir 1.9 will just pick it up and merge runtime vars into the end config?
[20:21:41] nickjj: yeah, i was just asking what would end up being replaced / used, but it sounds like i should wait for 1.9 to be released
[20:22:04] nickjj: because after glancing the new Config module, it seems like a number of things will need to be changed
[20:23:33] nickjj: if you had to guess, do you think both 1.9 and phoenix 1.5 will be out around the same time?
[20:24:39] nickjj: the phoenix 1.5 milestone on github looks like it might not be the place to track the progress on 1.5 anymore since it hasn't been modified in 6 months
[20:25:23] nickjj: yeah, just use the new Config module and follow the docs on whatever elixir 1.9 says once it's available?
[20:26:51] nickjj: cool thanks, such good timing on releases too, with any luck i'll be deploying my first app maybe a month or 2 after 1.9 ships
[20:28:02] nickjj: i've deployed 0 elixir apps, so it'll be deploying from ground zero (for elixir at least)