« Back to channel list

#RubyOnRails - 18 August 2018

« Back 1 day Forward 1 day »
[00:03:52] aeontech: has joined #RubyOnRails
[00:05:18] havenwood: jeromelanteri: what with?
[00:05:44] jeromelanteri: havenwood, i'm unable to make running well ajax with rails-5.2
[00:06:09] jeromelanteri: i'm trying to understand wht with a little testcase application
[00:06:34] jeromelanteri: and ok, i have a template view with a list of articles, and a form for new article.
[00:07:36] jeromelanteri: the ajax mechanism on form new article is working fine (i mean... create.coffee is call and add a new row to the table list of article in the index html template view.
[00:09:03] sameerynho: has joined #RubyOnRails
[00:09:31] jeromelanteri: but the index.coffee is running when call from kaminari pagination remote (index action through JS show by puma, then index.coffee is call) but nothing more happening... the params[:page] show value 2 (i do a puts params[:page] who show that: 1/ action is call, and 2/ parameter is read by index action)
[00:10:12] jeromelanteri: the id targets (1/ the list of articles and 2/ the pagination row from jaminari) are not updated
[00:11:07] jeromelanteri: an "alert" line in the index.coffee script file show that alert was never call but puma show no error and show that SQL from render code from index.coffee was run....
[00:12:03] jeromelanteri: also... i have a raijs-ujs error who is talking about: syntaxError expected expression got '<'
[00:12:26] jeromelanteri: (i disabled turbolinks also...)
[00:17:29] FooBarWidget: has joined #RubyOnRails
[00:19:41] jeromelanteri: and also, inside puma information, i see a line tell me that it rendering index.html.haml... but why ? just 2 lines up to this one it show that the call is for JS format, and not for HTML format... i also have a respond_to do |format| in the index controller who has to NOT rendering html when JS is call.
[00:24:44] jeromelanteri: puma output: https://ptpb.pw/Rkwf
[00:25:33] jeromelanteri: my article controller is: https://ptpb.pw/4yNy
[00:26:41] jeromelanteri: index.coffee is https://ptpb.pw/9snF
[00:27:37] jeromelanteri: if you would like something more for be inspired to help me, tell me what i can show more.
[00:39:25] orbyt_: has joined #RubyOnRails
[00:42:05] gambl0re: has joined #RubyOnRails
[00:52:30] auctumnus: has joined #RubyOnRails
[00:55:46] s2013: has joined #RubyOnRails
[01:00:23] j0bk: has joined #RubyOnRails
[01:01:05] auctumnus: hello! i'm getting an issue "undefined method `images' for nil:NilClass", here's the gist: https://gist.github.com/auctumnus/f279bdb2284fa4dff4da1e588b1c3205
[01:01:26] auctumnus: if i forgot to include something that might help let me know
[01:07:10] jqpl: auctumnus: the only place you're calling #images is on @reply, which is set from @post.replies.create, so is that method returning nil ?
[01:07:28] auctumnus: i believe yes
[01:08:12] auctumnus: oh, it'd make sense that it'd be returning nil, the old replies from when i was testing before i added the ability to add them to posts dont have any images
[01:08:33] auctumnus: lemme try on a post that doesnt have replies
[01:09:31] auctumnus: nope, gives me the same error at the same place if i add a new reply
[01:11:03] jqpl: auctumnus: is it just failing validation?
[01:12:31] jqpl: oh wait the model's right there
[01:16:04] za1b1tsu_: has joined #RubyOnRails
[01:23:12] jeromelanteri: first of all... i do not understand why rails render a html when the call is for a JS format... someone can explain this please ?
[01:26:36] fryguy: what's the code look like?
[01:31:50] jeromelanteri: fryguy, i print controller code and coffeescript code up there, which one would you like to see ?
[01:37:12] jeromelanteri: fryguy, also, if i just follow the guide and do not add any jquery-rais gem (so just use default rails-5.2 rails-ujs alone), i get a javascript error who said that $ is not defined (directly...) from article.coffee code who is a copy/paste from guide like $(document).ready -> .... and the javascript code is well converted as i can see in the firefow debugger
[01:37:28] jeromelanteri: ok, which code do you want to see ?
[01:38:40] s2013: has joined #RubyOnRails
[01:38:59] za1b1tsu_: has joined #RubyOnRails
[01:41:13] Dimik: has joined #RubyOnRails
[01:43:54] fcser_: has joined #RubyOnRails
[01:45:13] GodFather: has joined #RubyOnRails
[01:46:08] fryguy: jeromelanteri: the code that drives the controller, or a console log of interacting with the controller via curl, or a failing test case in minitest or rspec
[01:47:07] jeromelanteri: fryguy, ok well... i'm going to open a bitbucket public repo for push the testcase code and show all of the simple code.
[01:50:51] s2013: has joined #RubyOnRails
[01:54:01] jeromelanteri: fryguy, https://bitbucket.org/jerome___/test_ajax_rails/src/master/
[01:55:02] fryguy: ok, and which view does this?
[01:58:21] faitswulff: has joined #RubyOnRails
[01:59:01] DTZUZO: has joined #RubyOnRails
[02:02:35] jeromelanteri: fryguy, the main view i use is index
[02:02:58] fryguy: ok, and where do you call the js stuff?
[02:03:09] jeromelanteri: actually, i have problem with ajax (without ajax, all is fine)
[02:05:20] jeromelanteri: when try to add jquery-rails, i have a little bit more luck (by little bit, i mean that an error about: '$ is not defined' diaspear for article.coffee code)
[02:05:37] jeromelanteri: but rails-ujs error is always there
[02:05:46] jeromelanteri: (look at readme.md file)
[02:07:55] ariedler: has joined #RubyOnRails
[02:08:22] jeromelanteri: fryguy, i call this js stuff from submit form button (for create JS call), and from kaminari pagination buttons (for index JS remote call).
[02:10:14] jeromelanteri: together make problems... i got some little luck with jequery-rails... but not to full luck. Actually, i'm thinking i'm doing something wrong so i'm beck to try with ariginal rails-5.2 included gems... but... 3 days of fight without any luck with AJAX.
[02:11:32] jeromelanteri: fryguy, and also thank you very much to try to help me, because actually you are the first one to try. Maybe ajax is a real mission with rails... i don't know.
[02:11:36] za1b1tsu_: has joined #RubyOnRails
[02:15:33] fryguy: i think you have a lot of problems here, one you are trying to mix and match coffee and javascript files, it seems like your js files aren't named correctly, they aren't being properly escaped, and you are also maybe confusing json and js as return types, and neither of these have the concept of layouts, so `render layout: false` doesn't make any sense. I'd take a step back and start to write some
[02:16:26] jeromelanteri: ok, so wich name for coffee script is fine ?
[02:17:20] fryguy: depends on how the gem adds it, i'd guess it's .js.coffee, but see what the test tells you
[02:17:24] jeromelanteri: (i will also remove render layout: false and let only format.js... i was so confused that i tryed many things without undesrtand really what i have to know)
[02:18:18] jeromelanteri: fryguy, what make me surprised is that pemu show that index.coffee or create.coffe are executed together... and it reads the render part of theses script codes
[02:20:24] jeromelanteri: fryguy, also, "depend on how gem adds it" make me confused because i was expecting about a convention to follow... i try js.erb (without coffeescript code), and js (without erb extention), and coffee, and js.coffee, and only coffee... depend of jquery-rails gem prensent or not that change the comportment, but without it seems to be the same.
[02:23:52] jeromelanteri: fryguy, well, now i remove all rendert layout: false from format.js (create and index method together), and renamed create.coffee for create.js.coffee. Exactly the same problem happend. What i see is that in puma messages, without render layout: false, there is no more call of render html (that seems to be logic). but stay same error rails-ujs.
[02:24:24] jeromelanteri: fryguy, did you try to clone the repo for test it running ?
[02:29:52] fryguy: i did not
[02:30:09] jeromelanteri: fryguy, and do you use ajax with rails usualy ?
[02:30:52] jeromelanteri: fryguy, and you was confronted of these problems ? from rails-5.2 also ?
[02:31:55] fryguy: not really
[02:32:04] jeromelanteri: you use rails-5.2 ?
[02:33:04] fryguy: I have, yes
[02:33:52] jeromelanteri: fryguy, please, my code is very simple and i do push a full testcase. Could you try to use it ?
[02:35:05] fryguy: don't really have time to do a full code review right now
[02:36:58] jeromelanteri: fryguy, ok. thank to tryed to help a bit. if one day you have time for git clone and run this test case, maybe you will find what i'm doing wrong (because now, i'm thinking that if you use rails-5.2 with ajax without any problem... then my code has something wrong)
[02:38:29] fryguy: it's definitely your code, rails isn't released with some bug that's just like "oh, ajax doesn't work"
[02:40:27] jeromelanteri: fryguy, ok, but it is difficult when you follow the guide to be confronted directly with errors and no one tell you why when you ask (3 days to ask and fight with that also...)
[02:41:30] jeromelanteri: i also had to read comment here about someone who directly said that he doesn't want to "assist" (it is is word) someone who learn rails (so a beginner). Wow...
[02:42:15] saiyanprince: has joined #RubyOnRails
[02:42:19] saiyanprince: has left #RubyOnRails: ()
[02:47:32] faitswulff: has joined #RubyOnRails
[02:56:29] faitswulff: has joined #RubyOnRails
[02:56:34] ariedler: has joined #RubyOnRails
[03:04:52] dviola: has joined #RubyOnRails
[03:09:24] sevenseacat: has joined #RubyOnRails
[03:09:41] za1b1tsu_: has joined #RubyOnRails
[03:10:34] braincrash: has joined #RubyOnRails
[03:12:14] faitswulff: has joined #RubyOnRails
[03:15:57] faitswulff: has joined #RubyOnRails
[03:41:36] Technodrome: has joined #RubyOnRails
[03:46:25] ariedler: has joined #RubyOnRails
[04:00:06] faitswulff: has joined #RubyOnRails
[04:17:33] faitswulff: has joined #RubyOnRails
[04:22:44] j0bk: has joined #RubyOnRails
[04:34:59] Saukk: has joined #RubyOnRails
[04:37:10] faitswulff: has joined #RubyOnRails
[04:37:17] za1b1tsu_: has joined #RubyOnRails
[04:45:37] quazimod2: has joined #RubyOnRails
[04:47:33] za1b1tsu_: has joined #RubyOnRails
[04:49:27] quazimodo: has joined #RubyOnRails
[05:05:25] kapil___: has joined #RubyOnRails
[05:05:43] kapil___: I want to disable directory watching on rails how to do it,?
[05:08:44] armyriad: has joined #RubyOnRails
[05:10:27] quazimodo: has joined #RubyOnRails
[05:15:14] za1b1tsu_: has joined #RubyOnRails
[05:17:09] faitswulff: has joined #RubyOnRails
[05:46:52] ragsagar: has joined #RubyOnRails
[06:03:15] segy: has joined #RubyOnRails
[06:11:24] reber: has joined #RubyOnRails
[06:17:30] segy: has joined #RubyOnRails
[06:18:33] s2013: has joined #RubyOnRails
[06:26:14] tdy: has joined #RubyOnRails
[06:33:21] armyriad: has joined #RubyOnRails
[06:36:58] apeiros: has joined #RubyOnRails
[07:04:36] xhoy: has joined #RubyOnRails
[07:05:13] faitswulff: has joined #RubyOnRails
[07:12:39] orbyt_: has joined #RubyOnRails
[07:15:45] jottr: has joined #RubyOnRails
[07:28:01] Dbugger: has joined #RubyOnRails
[08:03:31] snickers: has joined #RubyOnRails
[08:08:00] za1b1tsu: has joined #RubyOnRails
[08:22:17] srinidhi: has joined #RubyOnRails
[08:27:30] za1b1tsu_: has joined #RubyOnRails
[08:42:46] Andr3as: morning.. i never created an admin section like this before.. so i made a namespace :admin and put my stuff in a "do / end".. routes are working fin, index actions too though i have a bit of a struggle with a "new" action...
[08:42:55] Andr3as: this is a gist https://gist.github.com/awunder/e143b80d85dd1e9a6feaea0b60513148 of it
[08:42:57] ragsagar: has joined #RubyOnRails
[08:43:16] Andr3as: as a teaser, i am getting "NameError - uninitialized constant Admin::InstrumentTemplatesController::InstrumentTemplate:"
[08:43:23] Andr3as: anyone with a hint?
[08:49:30] sevenseacat: Andr3as: do you have a model called InstrumentTemplate?
[08:49:41] Andr3as: sevenseacat: yes
[08:49:48] sevenseacat: do you? where is it?
[08:50:33] Andr3as: forget it.. typo.. argh
[08:50:51] Andr3as: thx a ton.. saved my day
[08:52:55] sameerynho: has joined #RubyOnRails
[09:06:36] za1b1tsu: has joined #RubyOnRails
[09:17:33] Code_[24]: has joined #RubyOnRails
[09:17:49] Code_[24]: hello I am new :)
[09:21:24] Code_[24]: Can i ask a technical question here ?
[09:22:29] Andr3as: dont ask to ask, just ask
[09:22:32] sevenseacat: and welcome :)
[09:23:17] Code_[24]: Thanks - I can build CRUD without Scaffold in RoR. About 6 months in. I want to build a Book Borrowing app but not sure how to go about it.
[09:23:39] Code_[24]: Any tips would be great
[09:23:43] Andr3as: i have another one as well.. am using the responders gem with a "location" redirect.. i do it like this respond_modal_with @instrument_template, location: "/admin#instrument_templates"
[09:24:27] sevenseacat: Code_[24]: well what are you stuck on particularly?
[09:24:33] Andr3as: if i use a location "/admin" it does just fine "/admin#instrument_templates" isnt working though.. no errors either.. anyone an idea how to redirect to urls / paths like this?
[09:26:19] Code_[24]: I have a User model a Book model. Books must be borrowed, how do I allocate a Book to a User and remove it from being able to be borrowed
[09:27:19] dionysus69: has joined #RubyOnRails
[09:27:34] sevenseacat: so it sounds like you want another model in the middle - something like 'user X borrowed book Y for these dates'
[09:28:46] Code_[24]: Yes, just not sure how to even start on it :)
[09:28:46] sevenseacat: we can chat here, no need for PM
[09:29:04] sevenseacat: ok, so lets think of a good name for this model in the middle
[09:30:26] Code_[24]: Borrowable_List ? It would list every book and Boolean = False if Borrowed ?
[09:30:50] sevenseacat: no no, you'd have individual instances per book being borrowed
[09:30:54] Andr3as: sevenseacat: real quick, you have maybe a hint re my redirect problem?
[09:31:10] sevenseacat: something like a Loan model
[09:31:23] sevenseacat: Loan belongs to book, belongs to user
[09:31:34] Andr3as: Code_[24]: i'd go for the thing sevenseacat has mentioned.. let there be an entry for each occurence a book has been borrowed.. kinda l ike a "registration for borrowings"
[09:32:15] Andr3as: that even stores a history which you can do some stats on, later
[09:32:18] sevenseacat: Andr3as: I stopped using the responders gem many years ago, it was too magic for me
[09:32:27] Andr3as: sevenseacat: sh.t
[09:32:45] ragsagar: has joined #RubyOnRails
[09:34:06] Code_[24]: ok thanks I'll try work something out
[09:34:26] Code_[24]: thanks for the tip
[09:58:00] ragsagar: has joined #RubyOnRails
[10:25:20] ragsagar: has joined #RubyOnRails
[10:32:47] kapil___: has joined #RubyOnRails
[10:42:21] duderonomy: has joined #RubyOnRails
[10:45:30] jottr: has joined #RubyOnRails
[10:57:54] wethu: has joined #RubyOnRails
[11:00:37] ragsagar: has joined #RubyOnRails
[11:30:50] jottr: has joined #RubyOnRails
[11:34:28] chridal: When using webpacker my compiled application.js file is a lot shorter than the one in development
[11:34:55] chridal: Any thoughts? I tried unminifying it, and even then the ration was like 700'000 lines vs 300'000
[11:35:09] chridal: I mean characters, not lines.
[11:35:42] chridal: I'm not getting any errors during compilation, but if I include the minified file in production, nothing renders on screen.
[11:40:40] DTZUZO: has joined #RubyOnRails
[11:42:56] faitswulff: has joined #RubyOnRails
[11:46:32] jottr: has joined #RubyOnRails
[11:47:19] dionysus70: has joined #RubyOnRails
[11:48:52] jeromelanteri: has joined #RubyOnRails
[11:59:06] Technodrome: has joined #RubyOnRails
[12:11:53] dionysus69: has joined #RubyOnRails
[12:15:21] faitswulff: has joined #RubyOnRails
[12:19:36] kapil___: want to disable directory watching on rails how to do it,?
[12:37:21] chridal: has left #RubyOnRails: ("WeeChat 2.2-dev")
[12:37:33] GodFather: has joined #RubyOnRails
[12:39:12] chridal: has joined #RubyOnRails
[12:42:45] jottr: has joined #RubyOnRails
[12:46:02] apparition: has joined #RubyOnRails
[13:01:39] ariedler: has joined #RubyOnRails
[13:11:15] jeromelanteri: fryguy, well... i see that in fact, rails-5.2 doesn't works out of the box with ajax and jquery. That explain error about "$"... in fact, what the guide doesn't said is that rails-5.2 also need jquery. A "new" (again) way is to install it with yarn... and add it to applicaation.js BEFORE rails-ujs.
[13:11:16] faitswulff: has joined #RubyOnRails
[13:11:58] Technodrome: has joined #RubyOnRails
[13:12:25] jeromelanteri: guide should be updated for explain that also. And people there who want to help without help should be stop to be so strong with people who doesn't know and ask (because if they knew, they will not aska lso..)
[13:14:25] ariedler: has joined #RubyOnRails
[13:21:37] jottr: has joined #RubyOnRails
[13:33:36] jtperreault: has joined #RubyOnRails
[13:38:29] reber: has joined #RubyOnRails
[13:51:06] jeromelanteri: fryguy, also, if i not add this { render layout: false }, then i have this error i told you about javascript error expected expression got '<'... because server get back a html page with first line of html document type... so i'm not sure you use jquery with rails-5.2 as you said this day... or is there is an other one way to do, you forget to tell me which one is... but thank you to tryed to help, no one
[13:51:06] jeromelanteri: other tryed before you... 3 days to ask... big and wonderfull community there ! bravo and thank you very much.
[13:51:15] jeromelanteri: has left #RubyOnRails: ("Bye...")
[14:00:16] ariedler: has joined #RubyOnRails
[14:12:35] faitswulff: has joined #RubyOnRails
[14:14:46] ragsagar: has joined #RubyOnRails
[14:18:10] mikecmpbll: has joined #RubyOnRails
[14:23:56] faitswulff: has joined #RubyOnRails
[14:29:45] IanMalcolm: has joined #RubyOnRails
[14:31:07] xlegoman: has joined #RubyOnRails
[15:02:37] danguita: has joined #RubyOnRails
[15:03:34] Technodrome: has joined #RubyOnRails
[15:06:42] kapil___: has joined #RubyOnRails
[15:09:32] laekur: has joined #RubyOnRails
[15:13:37] danguita: has joined #RubyOnRails
[15:13:58] dviola: has joined #RubyOnRails
[15:22:32] jottr: has joined #RubyOnRails
[15:27:20] danguita: has joined #RubyOnRails
[15:40:31] za1b1tsu: has joined #RubyOnRails
[15:45:14] p8m: has joined #RubyOnRails
[15:53:40] ariedler: has joined #RubyOnRails
[15:54:22] LenPayne: has joined #RubyOnRails
[15:55:48] Alchemical: has joined #RubyOnRails
[16:13:22] dionysus69: has joined #RubyOnRails
[16:18:51] Technodrome: has joined #RubyOnRails
[16:41:08] Dimik: has joined #RubyOnRails
[16:46:21] IanMalcolm: has joined #RubyOnRails
[16:47:29] fmcgeough: has joined #RubyOnRails
[17:15:35] ragsagar: has joined #RubyOnRails
[17:19:27] s2013: has joined #RubyOnRails
[17:23:18] jottr: has joined #RubyOnRails
[17:44:02] faitswulff: has joined #RubyOnRails
[17:46:24] w0rd-driven: has joined #RubyOnRails
[17:51:19] ragsagar: has joined #RubyOnRails
[17:54:13] faitswulff: has joined #RubyOnRails
[17:59:45] dionysus69: has joined #RubyOnRails
[17:59:45] xlegoman: has joined #RubyOnRails
[18:02:02] ragsagar: has joined #RubyOnRails
[18:08:28] darkhanb: has joined #RubyOnRails
[18:34:01] IanMalcolm: has joined #RubyOnRails
[18:36:17] ragsagar: has joined #RubyOnRails
[18:44:07] faitswulff: has joined #RubyOnRails
[19:02:45] s2013: has joined #RubyOnRails
[19:24:11] jottr: has joined #RubyOnRails
[19:32:55] atrius: has joined #RubyOnRails
[19:56:45] s2013: has joined #RubyOnRails
[20:03:53] DTZUZO: has joined #RubyOnRails
[20:04:45] ragsagar: has joined #RubyOnRails
[20:16:05] s2013: has joined #RubyOnRails
[20:22:40] Xiti`: has joined #RubyOnRails
[20:22:49] IanMalcolm: has joined #RubyOnRails
[20:24:18] amperry: has joined #RubyOnRails
[20:27:37] amperry: Hi folks, I'm getting an error that I have very little to go on, so as a workaround until I can fix that, I want to use either a cron job or scheduled rake task to check if the server is up, and if not, to restart it. I'm having bad luck with the cron approach, however, and I have no idea what a rake task would look like to do this.
[20:27:42] amperry: cf. https://gist.github.com/amp108/b1068d117f036b6526ef796ba2d5e542
[20:27:53] dionysus69: has joined #RubyOnRails
[20:34:57] tpendragon: has joined #RubyOnRails
[20:45:13] IanMalcolm: has joined #RubyOnRails
[20:47:07] orbyt_: has joined #RubyOnRails
[20:58:32] dviola: has joined #RubyOnRails
[21:04:34] IanMalcolm: has joined #RubyOnRails
[21:07:32] gambl0re: has joined #RubyOnRails
[21:08:58] s2013: has joined #RubyOnRails
[21:16:51] atrius: has joined #RubyOnRails
[21:20:08] s2013: has joined #RubyOnRails
[21:25:01] jottr: has joined #RubyOnRails
[21:25:56] s2013: has joined #RubyOnRails
[21:53:03] DTZUZO: has joined #RubyOnRails
[22:01:59] apeiros: has joined #RubyOnRails
[22:14:51] apeiros: has joined #RubyOnRails
[22:17:26] tdy1: has joined #RubyOnRails
[22:25:24] za1b1tsu: has joined #RubyOnRails
[22:27:16] reber: has joined #RubyOnRails
[22:28:06] s2013: has joined #RubyOnRails
[22:28:57] apeiros: has joined #RubyOnRails
[22:42:37] apeiros: has joined #RubyOnRails
[22:45:36] fmcgeough: has joined #RubyOnRails
[22:54:46] apeiros: has joined #RubyOnRails
[23:05:48] apeiros: has joined #RubyOnRails
[23:14:45] moei: has joined #RubyOnRails
[23:17:31] apeiros: has joined #RubyOnRails
[23:25:57] jottr: has joined #RubyOnRails
[23:27:33] apeiros: has joined #RubyOnRails
[23:32:08] za1b1tsu: has joined #RubyOnRails
[23:42:07] apeiros: has joined #RubyOnRails
[23:44:15] fourcolors: has joined #RubyOnRails
[23:58:56] apeiros: has joined #RubyOnRails