<     May 2017     >
Su Mo Tu We Th Fr Sa  
    1  2  3  4  5  6  
 7  8  9 10 11 12 13  
14 15 16 17 18 19 20  
21 22 23 24 25 26 _2_7  
28 29 30 31
00:08 wpcarro joined
00:08 rschmukler joined
00:21 <asonge> do for comprehension filters short-circuit?
00:22 Andrevan joined
00:23 <asonge> well, putting guards in the generators where possible sure helps.
00:34 wpcarro joined
00:36 pbj joined
00:37 ZippoWeb joined
00:38 milad joined
00:45 dimitarvp_ joined
00:46 bambanx joined
00:50 refriedchicken joined
00:53 pbj joined
00:59 NeverDie joined
01:05 wpcarro joined
01:21 pbj joined
01:26 asabil joined
01:39 tomterl joined
01:39 nhooyr joined
01:46 wpcarro joined
01:49 jkreeftmeijer joined
01:50 elgenie joined
01:52 gvaughn joined
02:00 pbj joined
02:07 NeverDie joined
02:11 iamvery joined
02:16 cschneid_ joined
02:16 cschneid_ joined
02:27 milad joined
02:29 LastWhisper____ joined
02:30 elgenie joined
02:33 milad joined
02:40 r00tl3ss joined
02:53 wpcarro joined
02:58 NeverDie joined
03:02 <iFire> asonge: do they?
03:02 <iFire> now I'm curious
03:05 <asonge> iFire: i was relying on running a few generators in a for comprehension and then filtering out stuff (spent the afternoon playing with project euler), adding filters right after the generator helps, and adding a guard to the generator match helps even more
03:05 <asonge> because it saves running the next generator in the list
03:05 <iFire> asonge: Hmm I want a small project that is limited in scope. I was wondering this security thing could be easy. https://github.com/joyent/node-aperture
03:06 <iFire> Any ideas? it's using a regex dsl parser...
03:06 <iFire> has tests though
03:11 pbj joined
03:12 elgenie joined
03:43 ssswitch joined
03:47 wpcarro joined
03:50 jkreeftmeijer joined
03:55 wpcarro joined
03:57 pbj joined
04:00 mika_ joined
04:11 justelex_ joined
04:11 rekyuu joined
04:21 milad joined
04:47 pbj joined
05:08 wpcarro joined
05:16 milad joined
05:17 hakunin_ joined
05:25 JuanMiguel joined
05:34 cemilowski joined
05:41 notdaniel joined
05:41 r00tl3ss joined
05:41 laut joined
05:47 gvaughn joined
05:52 jkreeftmeijer joined
05:55 pbj joined
06:06 yourname joined
06:10 milad joined
06:31 tuacker joined
06:33 jeffweiss joined
06:41 gvaughn joined
06:53 jkreeftmeijer joined
06:56 cschneid_ joined
06:57 dastagg joined
06:58 pbj joined
07:04 milad joined
07:11 griffinbyatt joined
07:16 wsieroci joined
07:27 milad joined
07:29 qqwy joined
07:33 apotry joined
07:40 wpcarro joined
07:40 marr joined
07:48 pbj joined
07:50 Ioyrie joined
08:00 PaReeOhNos joined
08:00 justelex_ joined
08:11 griffinbyatt joined
08:14 ZippoWeb joined
08:27 milad joined
08:37 pbj joined
08:46 jkreeftmeijer joined
09:07 arpunk joined
09:11 PaReeOhNos joined
09:12 griffinbyatt joined
09:14 squalloser joined
09:19 arquebus joined
09:20 arquebus joined
09:20 r00tl3ss joined
09:21 arquebus joined
09:22 arquebus joined
09:23 arquebus joined
09:24 milad joined
09:24 arquebus joined
09:25 lexmag joined
09:26 ZippoWeb joined
09:29 milad joined
09:30 jkreeftmeijer joined
09:34 jkreeftmeijer joined
09:37 wsieroci joined
09:39 Ioyrie joined
09:43 <Nicd-> jesses: I'm not in the PaaS market but it looks very cool and I wish you success in your project :)
09:45 <steffkes> probably a starter-question .. but the Access behaviour for a struct. is there anywhere more information about it as on https://hexdocs.pm/elixir/Access.html#module-implementing-the-access-behaviour-for-custom-data-structures ?
09:45 <steffkes> i'm reading through the access.ex of elixir-lang .. but a sample would definitely help ;o
09:46 pbj joined
09:53 wpcarro joined
10:02 DarkArcher207 joined
10:07 JuanMiguel joined
10:10 imack joined
10:13 griffinbyatt joined
10:15 _2easy joined
10:15 _2easy joined
10:26 Ioyrie joined
10:30 gmcabrita joined
10:34 sillyotter joined
10:35 sillyotter joined
10:44 pbj joined
10:51 jkreeftmeijer joined
10:57 JuanMiguel joined
11:03 r00tl3ss joined
11:04 Siyo joined
11:04 Siyo joined
11:08 PaReeOhNos joined
11:13 Guest67 joined
11:25 mika_ joined
11:35 Ven joined
11:39 Siyo joined
11:39 Siyo joined
11:40 PaReeOhNos joined
11:41 Ven_ joined
11:51 dimitarvp joined
11:53 jkreeftmeijer joined
11:54 wsieroci joined
11:57 cschneid_ joined
11:59 josevalim joined
12:05 wpcarro joined
12:07 rschmukler joined
12:12 r00tl3ss joined
12:13 elgenie joined
12:14 griffinbyatt joined
12:20 rodolfojcj joined
12:26 Ven_ joined
12:34 Ven joined
12:36 markw_ joined
12:44 wpcarro joined
12:50 Ven_ joined
13:00 gvaughn joined
13:00 meh` joined
13:04 Ven_ joined
13:12 asabil joined
13:16 griffinbyatt joined
13:17 hbraun joined
13:19 gvaughn joined
13:20 gvaughn_ joined
13:21 justelex_ joined
13:21 Ven_ joined
13:21 josevalim joined
13:31 pbj joined
13:33 Ven joined
13:35 justelex_ joined
13:40 Ven_ joined
13:45 lurker joined
13:54 jkreeftmeijer joined
13:55 jkreeftmeijer joined
13:58 tuacker1 joined
13:58 JuanMiguel joined
14:03 Ven_ joined
14:04 markw_ joined
14:10 Ven_ joined
14:11 <kansi> hi, i am trying execute an ecto query but keeps throwing error field `my_field` in `where` does not exist in the schema in query
14:11 <kansi> the field is defined using belongs_to in the schema
14:12 <Ankhers> kansi: Can you post the schema and the query?
14:12 pbj joined
14:14 kiltzman joined
14:14 <kansi> Ankhers: https://paste.fedoraproject.org/paste/4yzmcct1zdr0UAVRQqGX315M1UNdIGYhyRLivL9gydE=
14:16 elgenie joined
14:18 <Ankhers> kansi: You are using belongs_to incorrectly there. the belongs_to macro will automatically suffix the relation with _id. So right now your fields are actually user_left_id_id and user_right_id_id. Try removing the _id from the belongs to.
14:19 <kansi> oh, ok
14:21 <kansi> that works thx :)
14:21 <Ankhers> The reason for this is so when you call `friendship.user_left`, you will get the actual user (assuming it is preloaded). And then you can call `friendship.user_left_id` if you just want the ID value.
14:23 <kansi> ok, that makes much more sense now
14:23 Guest67 joined
14:24 pbj joined
14:24 <kansi> Ankhers: how do load associations then ?
14:26 <Ankhers> You would use one of the preload functions. https://hexdocs.pm/ecto/Ecto.Query.html#preload/3 or https://hexdocs.pm/ecto/Ecto.Repo.html#c:preload/3.
14:26 NeverDie joined
14:27 <Ankhers> The first one is for use during a query. Repo.all(from f in Foo, where: f.bar == ^"some_val", preload: :baz). This assumes Your Foo has some Baz relation.
14:27 <Ankhers> If you already have a Foo, or a list of Foos. You can do foos = Repo.preload(foos, :baz)
14:27 <Ankhers> I hope that made sense.
14:31 Ven joined
14:35 pbj joined
14:38 Ven_ joined
14:41 wpcarro joined
14:44 tuacker joined
14:44 PaReeOhNos joined
14:44 Ven_ joined
14:45 Ven_ joined
14:45 gvaughn joined
14:52 hashpuppy joined
14:56 jkreeftmeijer joined
14:58 pbj joined
14:58 wsieroci joined
14:59 Ioyrie joined
15:03 rodolfojcj joined
15:06 patientplatypus joined
15:06 <patientplatypus> hi
15:07 <patientplatypus> anyone here?
15:07 gvaughn joined
15:09 wpcarro joined
15:10 wpcarro_ joined
15:10 jkreeftmeijer joined
15:12 <hexkey[m]> yep
15:12 <hexkey[m]> I may/may not be able to help
15:12 <patientplatypus> im trying to follow along with this very basic tutorial here: https://monterail.com/blog/2015/phoenix-blog. About halfway down where I'm supposed to add the add_comment to routing in the postController I get confused. I'm supposed to add https://hastebin.com/usivevowik.rb to somewhere in here https://hastebin.com/lehusoperi.sql but the blog isn't very specific. Does anyone have any ideas?
15:13 <patientplatypus> hi hexkey[m]
15:16 elgenie joined
15:17 griffinbyatt joined
15:18 rodolfojcj_ joined
15:19 <hexkey[m]> yeah this is a bit beyond me right now, sorry :\
15:19 <hexkey[m]> but there will be more people here later in the day
15:21 <patientplatypus> ok thanks anyway
15:22 <tuacker> patientplatypus: the wording there is a bit unlucky, 'add to routing' and 'write proper function in controller are two steps'
15:22 jkreeftmeijer joined
15:22 <tuacker> patientplatypus: you add the 'resources … post /commment … :add_comment' in your 'router.ex
15:22 <tuacker> ' file
15:23 josevalim joined
15:23 <tuacker> once you done that if you run 'mix phoenix.routes' in your console you should see the mentioned output
15:24 <tuacker> the next part with 'alias BlogPhoenix.Comment' then is now in your postcontroller.ex
15:24 <patientplatypus> ah
15:24 <patientplatypus> thank you
15:24 <patientplatypus> i saw postcontroller and sort of assumed you were supposed to add it in there and was very confused
15:27 asdfghzxcvbn joined
15:33 jkreeftmeijer joined
15:39 <OliverMT> phoenix_swagger feels very verbose in how you define stuff, I wish you could use module attributes to annotate the controller functions
15:39 <OliverMT> to derive the paths and methods
15:39 justelex joined
15:39 <hexkey[m]> personally, I'd stay away from rails when possible.
15:44 jkreeftmeijer joined
15:46 imack joined
15:47 <OliverMT> was that for me? I dont see anyone using the world rails anywhere
15:48 <hexkey[m]> patientplatypus was asking for help with making Elixir work w/ rails earlier
15:48 <patientplatypus> ah thank you - i think i recieved help on the part I couldnt figure out from tuacker
15:49 squall joined
15:50 asabil joined
15:55 jkreeftmeijer joined
15:57 NeverDie joined
15:58 cschneid_ joined
16:01 proteusguy joined
16:03 gvaughn joined
16:05 jkreeftmeijer joined
16:07 pbj joined
16:12 Ven joined
16:12 Guest67 joined
16:13 meandi_2 joined
16:14 kuochung_ joined
16:16 jkreeftmeijer joined
16:18 griffinbyatt joined
16:19 <kuochung_> phoenix 有比较好的中文文档么?
16:20 ssswitch joined
16:22 <patientplatypus> i have another error on this project I'm trying to compile if someone would be so kind as to take a look
16:22 <patientplatypus> https://hastebin.com/igoduraquc.cs
16:22 <patientplatypus> == Compilation error on file web/views/post_view.ex ==
16:22 <patientplatypus> ** (CompileError) web/views/post_view.ex:6: Comment.__struct__/1 is undefined, cannot expand struct Comment
16:23 <Ankhers> patientplatypus: Did you mean to write BlogPhoenix.Comment? Or did you alias that in the BlogPhoenix.Web module?
16:25 <patientplatypus> im just starting to learn this so im not quite sure about what youre asking but im following the guide here https://monterail.com/blog/2015/phoenix-blog. He writes that bit at the very beginning of Step 3
16:26 <patientplatypus> i simply copied it
16:26 <patientplatypus> is it incorrect?
16:26 <Ankhers> Do you have this code in a repository I can look at?
16:26 <patientplatypus> no but give me two seconds
16:27 jkreeftmeijer joined
16:27 greengriminal joined
16:28 trias joined
16:29 <patientplatypus> here you go Ankhers https://github.com/patientplatypus/playingphoenix
16:29 craigp joined
16:31 wpcarro joined
16:31 griffinbyatt joined
16:32 <Ankhers> patientplatypus: What step are you on?
16:32 <Ankhers> Because the code that you have is very strange.
16:33 <Ankhers> The show function that you have in your PostView is meant to be in your PostController I believe.
16:33 <patientplatypus> ive tried to complete it, but i guess ive probably mixed something up
16:34 <Ankhers> I just read the wording. It is very unfortunate and I understand why you put it there.
16:34 <Ankhers> "... beause we would like to have a comment form in the post view:".
16:34 <Ankhers> That code underneath (the show function) is meant to be in your controller.
16:36 Ven_ joined
16:36 <Ankhers> This also looks like a fairly outdated tutorial.
16:36 <patientplatypus> ah
16:37 pbj joined
16:37 <patientplatypus> yes, it now compiles, but it is not a very good tutorial and i am still on the phoenix default start screen. can you suggest a better tutorial or resource for phoenix webdev
16:37 <patientplatypus> just something simple
16:38 jkreeftmeijer joined
16:39 <Ankhers> https://pragprog.com/book/phoenix/programming-phoenix -- This was a good read. Unfortunately I do not know many tutorials to go through. I read a couple books quickly and just started coding.
16:39 <Ankhers> I knew some Erlang before starting Elixir, and I used Haskell in my spare time for a couple years before starting Elixir, so FP wasn't new to me.
16:40 PaReeOhNos joined
16:40 <Ankhers> But doing a quick google search for "phoenix build a blog" lead me to https://hackernoon.com/introduction-fe138ac6079d. I don't know how good it is, but it looks recent.
16:45 <iFire> Ankhers: what do you need from a blog?
16:45 <iFire> I mean just having a markdown editor, rest posting, editing and deleting is enough right with postgres
16:46 <iFire> I use a static page creator right now
16:46 <Ankhers> iFire: Sorry, I don't understand the question. If you are talking about me linking to the build a blog, it is because the last tutorial they were going through was to build a blog.
16:46 <iFire> patientplatypus: what do you want to do endgoal?
16:46 <patientplatypus> yes that was my question iFire
16:46 <patientplatypus> me?
16:46 <patientplatypus> well
16:48 <patientplatypus> i have a final project in a few weeks and I would like to build a toy in Phoenix that lets me have many users submit posts over a sort of websocket. It's going to be similar to that thing they had on reddit a bit ago that let anyone change the color of one pixel on a very big 8bit map
16:48 josevalim_ joined
16:48 <patientplatypus> i figure i have enough time to figure out how to do this
16:49 jkreeftmeijer joined
16:49 Guest67 joined
16:52 tonyc joined
16:52 PaReeOhNos joined
16:55 wpcarro joined
16:58 cschneid_ joined
16:59 gvaughn joined
16:59 jkreeftmeijer joined
17:00 refriedchicken joined
17:02 __0xAX joined
17:05 jkreeftmeijer joined
17:07 iamvery joined
17:07 mika_ joined
17:10 PaReeOhNos joined
17:13 PaReeOhNos joined
17:16 jkreeftmeijer joined
17:17 NeverDie joined
17:18 elgenie joined
17:25 asdfghzxcvbn joined
17:25 asdfghzxcvbn joined
17:25 asdfghzxcvbn joined
17:26 jkreeftmeijer joined
17:37 jkreeftmeijer joined
17:37 lexmag joined
17:43 jkreeftmeijer joined
17:43 PaReeOhNos joined
17:43 wpcarro joined
17:48 pbj joined
17:50 squall joined
17:55 gvaughn joined
17:56 elgenie joined
17:58 jkreeftmeijer joined
18:01 wpcarro joined
18:04 WhiskyRyan joined
18:06 milad joined
18:06 justelex joined
18:08 jkreeftmeijer joined
18:09 northfurr joined
18:10 PaReeOhNos joined
18:14 bungoman joined
18:18 pbj joined
18:19 Uniaika joined
18:19 jkreeftmeijer joined
18:30 jkreeftmeijer joined
18:38 greengriminal joined
18:40 jkreeftmeijer joined
18:46 ejpcmac joined
18:46 bambanx joined
18:49 JuanMiguel joined
18:51 gvaughn joined
18:56 josevalim joined
18:57 PaReeOhNos joined
19:00 <patientplatypus> hi
19:00 <patientplatypus> im trying to get this *very simple* hello world to compile in phoenix and im having trouble
19:01 <patientplatypus> if someone could take a look at this repo and let me know why localhost:4000/hello is 404 i would really appreciate it
19:01 <patientplatypus> https://github.com/patientplatypus/phoenixbrokenhelloworld
19:01 <asonge> patientplatypus: there's no route in the router.
19:02 pbj joined
19:02 <Ankhers> You should be able to reach localhost:4000 though.
19:04 <patientplatypus> huh - my atom was cached
19:04 <patientplatypus> wow is that frustrating
19:06 pbj joined
19:06 sp4rrow joined
19:07 <asonge> happens
19:14 wpcarro joined
19:15 ejpcmac left
19:17 jkreeftmeijer joined
19:18 pbj joined
19:19 justelex joined
19:22 PaReeOhNos joined
19:26 lexmag joined
19:28 <patientplatypus> hi
19:29 <patientplatypus> quick question
19:29 <patientplatypus> suppose i want to store information in an online database (like mlab for mongodb) with elixir. is there a good tutorial or information on how that is done?
19:30 <Ankhers> If you specifically want to use mongodb, you can use the mongodb package https://github.com/ericmj/mongodb/
19:30 meh` joined
19:30 <Ankhers> You could also use Ecto with mongodb as the store.
19:30 <Ankhers> Using https://github.com/michalmuskala/mongodb_ecto/
19:33 jkreeftmeijer joined
19:34 PaReeOhNos joined
19:39 _2easy joined
19:39 gvaughn joined
19:41 rodolfojcj joined
19:41 milad joined
19:44 wpcarro joined
19:45 Exuma joined
19:46 Exuma joined
19:48 Exuma joined
19:59 pbj joined
20:01 eddd joined
20:05 marr joined
20:06 jkreeftmeijer joined
20:06 refriedchicken joined
20:08 elgenie joined
20:08 wpcarro joined
20:13 asabil joined
20:13 MotherFlojo joined
20:14 Exuma joined
20:16 jkreeftmeijer joined
20:26 Sgeo joined
20:26 jkreeftmeijer joined
20:27 eddd joined
20:28 wpcarro joined
20:37 jkreeftmeijer joined
20:45 wpcarro joined
20:46 jimmyrcom joined
20:47 jkreeftmeijer joined
20:48 kochev joined
20:58 jkreeftmeijer joined
20:58 JuanMiguel joined
21:02 notdaniel joined
21:04 patientplatypus joined
21:04 <patientplatypus> hi
21:05 <patientplatypus> im getting this error in phoenix https://hastebin.com/ujelivimek.hs and im having trouble debugging as im new
21:05 <patientplatypus> does anyone know what the error might be
21:05 <patientplatypus> ?
21:06 <patientplatypus> i also changed this lib file
21:06 <patientplatypus> https://hastebin.com/udijuxeyeq.sql
21:06 NeverDie joined
21:08 jkreeftmeijer joined
21:10 ZippoWeb joined
21:14 jkreeftmeijer joined
21:18 greengriminal joined
21:20 asabil joined
21:25 jkreeftmeijer joined
21:27 wpcarro joined
21:35 jkreeftmeijer joined
21:36 <asonge> patientplatypus: so, it couldn't find the module for your application.
21:38 <patientplatypus> i think i got it asonge, thanks
21:38 greengriminal joined
21:40 pbj joined
21:45 jkreeftmeijer joined
21:47 strykerkkd joined
21:48 <benwilson512> fishcakez: know of any ets based fixed sized LRU caches?
21:49 <fishcakez> Not off top of my head but think searching for cache on hex
21:53 <benwilson512> there's some options, none I'm happy with, I don't think I strictly want LRU anyway, I want least used, will likely implement myself
21:56 jkreeftmeijer joined
22:02 jkreeftmeijer joined
22:12 jkreeftmeijer joined
22:12 <asonge> anyone here use the gen_stage and flow stuff a lot? i'm having trouble thinking about where in the tree of abstraction i need to look.
22:14 cschneid_ joined
22:23 jkreeftmeijer joined
22:32 iamvery joined
22:33 jkreeftmeijer joined
22:39 eddd joined
22:41 pbj joined
22:42 wpcarro joined
22:43 jkreeftmeijer joined
22:46 LastWhisper____ joined
22:50 <Ankhers> ericmj:
22:50 <Ankhers> ping
22:54 jkreeftmeijer joined
22:55 <Ankhers> Actually, anyone can answer this. I'm trying to start a program with Port.open/2. When I stop my Elixir program, the external program is still running. Should the external program stop when my Elixir app stops?
23:00 <patientplatypus> hi
23:00 <patientplatypus> i have
23:00 <patientplatypus> <%= link "View", to: user_path(@conn, :show, user.id) %>
23:01 <patientplatypus> in a template in my project
23:01 <patientplatypus> so i wanted to know what to.... was linking to?
23:01 <patientplatypus> so is user_path( a file somewhere i can find?
23:02 <Ankhers> It creates a link on the webpage. As in a clickable button that will bring you to another page.
23:02 <patientplatypus> sure
23:02 <patientplatypus> but to what file is user_path( pointing to? it points to some page and sends the user.id
23:02 <patientplatypus> but i cant quite follow if it points to a controller or template or route
23:03 <Ankhers> It doesn't point to a file, per se. In your router, you have something like `resources :user, UserController`.
23:04 <Ankhers> using `user_path(@conn, :show, user.id)` is telling it to send the browser to the show/2 function in the UserController (or whatever you named the controller).
23:04 <Ankhers> The user.id is sent as the `"id"` param.
23:04 <patientplatypus> sure
23:04 <patientplatypus> its a bit confusing, because i have /users and /user/:id
23:05 <patientplatypus> but user_path doesnt seem to specify which of those two it should go to
23:05 <patientplatypus> oh and i also have / of course
23:05 jkreeftmeijer joined
23:05 <patientplatypus> so
23:05 <Ankhers> Because you tell it to go to the show function.
23:06 <Ankhers> In web terms, you have different "REST" actions. Create, Read, Update, Delete. Sometimes refered to as CRUD.
23:06 <asonge> patientplatypus: those functions are generated by the "router helpers", and they're based on your routes.
23:06 <asonge> is that what you're asking?
23:06 <patientplatypus> ok
23:06 <patientplatypus> so here's the question
23:07 <Ankhers> So, if you go to /users, that is your index function. If you go to /users/some_id, that is show.
23:07 <Ankhers> If you POST to /users/some_id, that is an update. If you POST to /users, that is a new resource.
23:07 <Ankhers> POST being an HTTP verb.
23:07 <asonge> when you define your routes in the router, before it's done compiling, it emits another module that has a bunch of convenience functions that take a route name, the view that's being linked to, and all the arguments, and turns it back into a URL
23:07 <Ankhers> There are GET, POST, PUT and DELETE. There are more, but those are the common ones.
23:08 <asonge> patientplatypus: if you wanted to know how, instead of why, it exists
23:08 <patientplatypus> ok what if I have user_path(@conn, :index, user.id) instead?
23:09 <asonge> that probably would fail to match
23:09 <asonge> as there is no :index route that takes an argument to put in the url
23:09 <patientplatypus> as both "/" and "/users" take the index function how does that ....
23:10 <asonge> so, that second argument is just the name of the action...which 99% of the time matches in function in the controller
23:11 nhooyr joined
23:11 <asonge> patientplatypus: i think a lot of your questions may be answered in this: https://hexdocs.pm/phoenix/Phoenix.Router.html
23:12 wpcarro joined
23:15 mika_ joined
23:18 <patientplatypus> ok im very confused
23:18 <patientplatypus> so this https://hexdocs.pm/phoenix/Phoenix.Router.html
23:18 <patientplatypus> i understand
23:18 <asonge> patientplatypus: so, there's a little bit of inflection going on
23:19 <asonge> FooController turns into the functions foo_path and foo_url
23:19 <patientplatypus> alright
23:19 <patientplatypus> i see that
23:19 <asonge> :index is an atom that identifies the action
23:19 <patientplatypus> however
23:19 <asonge> it could be anything
23:19 <patientplatypus> i have
23:19 <asonge> go ahead.
23:19 <patientplatypus> to: user_path(@conn, :show, user.id)
23:20 <patientplatypus> and i have
23:20 <patientplatypus> get "/users/:id", UserController, :show
23:21 <patientplatypus> so i would expect that in my user_path.... even with the inflection it must be linking to /user/:id NOT /users/!
23:21 pbj joined
23:21 <patientplatypus> however if i change user_path to users_path i get a 404 error linking wrong
23:21 wpcarro joined
23:21 <Ankhers> Can you post the entire router/
23:21 <Ankhers> ?
23:21 <patientplatypus> so why am i dropping the s in the inflection? and dropping the s in such a manner that /user/ is wrong
23:21 <patientplatypus> sure one sec
23:22 <asonge> patientplatypus: there is *no* pluralization inflection.
23:22 <asonge> because it is a bad thing.
23:22 jkreeftmeijer joined
23:22 <patientplatypus> meaning the compiler always drops the s?
23:22 <patientplatypus> or never does
23:22 <asonge> it never does anything
23:22 <asonge> FooController turns to foo_path
23:22 <asonge> it's not based on your url
23:22 <asonge> it's based on the controller name
23:23 <patientplatypus> so this the entire router
23:23 <patientplatypus> https://hastebin.com/tumusimuso.rb
23:23 <Ankhers> This may be secondary, but it sounds like you want to use `resources "/users", UserController` instead of specifying all of the routes.
23:24 <asonge> `get "/blahblahblahblah/:id", UserController, :show` generates a function clause like `def user_path(conn, :show, param1), do: ...`
23:24 <asonge> that's *all*
23:24 <asonge> it looks at UserController and drops Controller off, and then runs User through an underscore function
23:25 <asonge> you can actually *rename* this in the router without inflecting off the controller
23:25 <patientplatypus> wait what?
23:25 <patientplatypus> so if i look at https://hexdocs.pm/phoenix/Phoenix.Router.html
23:25 <Ankhers> The helper functions are derived from the name of the controller module.
23:25 <patientplatypus> i see that get "/pages/:page", PageController, :show
23:25 <Ankhers> It is user_path because it is UserController.
23:25 <Ankhers> I believe if you used UsersController, it would be users_path.
23:26 <asonge> yes.
23:26 <asonge> and everyone will hate you for breaking convention.
23:26 <Ankhers> ^^
23:28 <asonge> patientplatypus: if you put `get "/pages/:page, PageController, :show, name: "someotherprefix"` you will get a function like `someotherprefix_path(conn, :show, "some page to show.html")`
23:28 wpcarro joined
23:28 <asonge> the `name` option in all of the macros that are used to define the routes can take a `name` to override getting it from the controller's name.
23:30 <patientplatypus> ok however i have
23:31 <patientplatypus> get "/users", UserController, :index
23:31 <patientplatypus> get "/users/:id", UserController, :show
23:31 <patientplatypus> so
23:31 <patientplatypus> why doesnt to: user_path(@conn, :show, user.id) link to both of them?
23:31 <asonge> do you know how pattern matching works?
23:31 <Ankhers> Because you are specifying you want the show action.
23:31 <patientplatypus> how come it knows to choose the second over the first
23:32 <patientplatypus> ok
23:32 jkreeftmeijer joined
23:32 <patientplatypus> so i can have multiple names linked so long as the actions are different HOWEVER if i had two different paths to the same controller with the same action THEN i would be in trouble right?
23:32 <asonge> (also, since they take a different number of arguments, they're technically separate functions)
23:33 <asonge> patientplatypus: possibly, but not necessarily
23:33 <patientplatypus> can you give an example of when not?
23:33 <asonge> if you had a different number of arguments in each one, or if you named the routes differently
23:34 <asonge> the way it works is it will go with the first "match"
23:34 <patientplatypus> hmm
23:34 <asonge> order matters in the router
23:34 <patientplatypus> pattern matching is a half layer abstraction farther up than i am used to working in
23:35 wpcarro joined
23:36 <asonge> maybe? have you tried to run the `mix phoenix.routes` command?
23:36 <asonge> erm, `mix phoenix.router` command*
23:37 <patientplatypus> ah
23:37 <patientplatypus> yes i seed
23:37 <patientplatypus> *see
23:37 <patientplatypus> heh
23:37 <patientplatypus> its actually a bit intuitive
23:39 <Ioyrie> patientplatypus which version of phoenix?
23:41 <patientplatypus> v1.2.1
23:43 jkreeftmeijer joined
23:45 <asonge> patientplatypus: btw, in the using macro for Foo.Web, there will be an `import Foo.Web.Router.Helpers` clause, and so that's where those functions come from. when `Foo.Web.Router` is compiled, the macros generate the `Foo.Web.Router.Helpers` module too.
23:45 <asonge> so that's how the full thing is all wired up.
23:46 <patientplatypus> interesting in
23:46 ssswitch joined
23:53 jkreeftmeijer joined
23:58 wpcarro joined