#RubyOnRails - 06 February 2018
« Back 1 day Forward 1 day »
[00:14:45] havenwood: FluffykinsTheTin: Non open-source graphical software to work on non-graphical open source software? Yup, heard of it!
[00:16:10] FluffykinsTheTin: there is? rubyonrails.org just mentions stackoverflow and this irc channel
[00:17:15] havenwood: FluffykinsTheTin: This IRC channel is popular, but yes there is an unofficial Slack community.
[00:18:10] FluffykinsTheTin: can't imagine why...there is no way to post snippets, and the UI is ugly
[00:19:25] havenwood: We use gists to post snippets. (Isn't that the same basically in the alternatives you list?)
[00:19:54] havenwood: This looks exactly how I want it to look. Unlike those other options that I can't write a client for.
[00:20:56] havenwood: FluffykinsTheTin: You can setup your IRC client to preview gists, if you'd like.
[00:21:16] havenwood: FluffykinsTheTin: https://gist.github.com/havenwood/a494df64c95c54ba491941914ab7f412
[00:21:53] baweaver: IRC has been going for years, so most of us have been here for years before Slack even came out. Might be that we'll still be here years after Slack as well
[00:26:36] havenwood: FluffykinsTheTin: You can choose from a myriad of clients or write your own. If you prefer closed playgrounds you can even pay for a closed source IRC client.
[00:27:12] havenwood: FluffykinsTheTin: Pick a nicer IRC client if you don't feel like implementing one.
[00:31:02] FluffykinsTheTin: on a more serious matter, anyone successfully integrate React into Rails?
[00:31:51] havenwood: FluffykinsTheTin: Lots of folk use react-rails or react_on_rails. In Rails 5.1+ you can just: rails new myapp --webpack=react
[01:24:00] mices: i wanted to override a model in a gem so i namespaced it into my app, now polymorphic doesn't work because the redirect from the controller sends the model type as double colon separated even though the value i passed was camelcase
[03:08:44] havenwood: FluffykinsTheTin: Ruby is the one language where there no debate: https://ukupat.github.io/tabs-or-spaces/
[03:09:50] havenwood: Clojure and Crystal are sooo close to consensus. (Please ignore the lone holdout.)
[03:37:28] FluffykinsTheTin: What's the best source to learn how to use react to make my Ruby app awesome? youtube? codecademy? etc...
[03:39:30] FluffykinsTheTin: Traversy Media on youtube seems to have some good content on React alone
[07:13:36] danielsousaio: Why does commenting accepts_nested_attributes_for in a model, shows me the corresponding fields in a new page using fields_for?
[08:32:28] zamuro: Sorry if I'm repeating myself... Is there a gem or something like that for creating web agents other than huginn? Or some documentation I can go to in order to set up an agent on my own.
[08:34:33] za1b1tsu: Hello, regarding filters and search functionality on an index action of a controller. Is ransack go to gem? Like will paginate is for pagination?
[08:38:37] zamuro: za1b1tsu: I personally use pgsearch for that. I set my filters on the model and then I can call the method on the controller action.
[10:50:09] crst: Hi, what can you do when the main script is in the head but js only works when it's after certain dom elements? The snippet is already inside $(document).ready
[10:51:34] tbuehlmann: crst: calling stuff in that callback sounds good to me. I assume it's just not executing?
[11:01:29] crst: This is from the view: https://bpaste.net/show/f0643099adb5 When my js is inside the <script> tag here it works
[11:05:12] dminuoso: (Im in the process of extracting a testcase, just wondering whether I can save myself the effort)
[11:05:24] morfin60: i have several resources: :products, :limited, :interiors etc, i need if i access index action of one of such controllers change canonical URL to add /All
[11:06:47] morfin60: *no, i need to output canonical URL including /all if user access /products instead of /products/All
[11:08:13] crst: dminuoso: I'm having huge latency when using webpacker at least in a certain app. Might this be related to your issue?
[11:16:58] morfin60: but /products/All is canonical when /products is not so i need to show canonical URL for this page because of SEO monkeys
[11:26:45] crst: dminuoso: Loading a request feels way longer than the time the profiler gives me. It seems like the profiler gives me the time the page usually loads without webpacker installed.
[11:32:32] crst: dminuoso: 0.18ms according to chrome. Where can I find the Middleware stack infos that you need? I'm sorry no pro here.
[11:38:37] crst: dminuoso: I can only tell of development. Even a fresh webpacker:install without adding anything to the views is enough to trigger the latency. "Error: Command 'middleware' not recognized"
[11:55:21] za1b1tsu: how can I see the doc for rails in pry? for example show-doc link_to, Couldnt not locate definition
[12:08:30] Terens: However although there is new_framework_defaults.rb initializer it seems that it has no effect
[12:09:03] tbuehlmann: za1b1tsu: if you're okay with just the source code, `$ helper.link_to` should do
[12:19:41] jrm: For an application that is running on a read-only filesystem, is there a way to prevent Gemfile.lock from being written. Alternatively, can it be written to an different location?
[12:30:02] dminuoso: crst: From when I checked last, there is not much you can profile into webpack.
[12:30:21] dminuoso: crst: Last time I basically went into the middleware and inserted my own instrumenter code.
[12:34:27] crst: dminuoso: Unfortunately not, I signed an NDA and can't reproduce the issue. Thanks anyway!
[12:39:01] crst: All right thanks. It might take me a couple of days/weeks to find the time for this.
[12:40:39] fox_mulder_cp: hi. i create gem which send xml to remote api, recieve answer in xml and i need convert xml to ruby object without use AR methods. how i can do this in easy way when i have a xml and xslt for it?
[12:51:37] dminuoso: crst: Perhaps indeed. Note that the point to create a testcase can isolate problems easily. So it's not just for sharing but also for yourself. :)
[14:45:46] tycoon177: why don't more rails tutorials focus on performance-oriented things like only selecting columns that you need?
[15:02:58] tycoon177: fox_mulder_cp: i'm not even talking about going that far. i see a lot of guides recommend blindly using #includes when #joins with #select is usually better performing in my experience. most of the time, you don't need complete models
[15:04:03] dminuoso: In most cases "guide" equals to "shitty resource" when it comes to software development.
[15:23:00] sinjin1985: hey guys, did anyone have issues with getting spread operator to work in rails5/yarn/es6? I tried installing babel-plugin-transform-object-rest-spread package with "yarn add babel-plugin-transform-object-rest-spread" but it still won't recognize the spread operator
[15:24:51] xcesariox: how to use non-beta version of rails like 5.1.4, when i gem update it install the rc version.
[15:30:15] havenwood: xcesariox: A `gem update` shouldn't use a prerelease version of Rails unless you use the --prerelease flag.
[15:35:09] crova: Would anyone argue against running your own server for an app where only 2 persons use it? Main reason here is database storage space (which would cost me more than I'm willing to pay on heroku)
[18:17:42] Inside: I'm got both react-rails and rails-momentjs in my project. I can reload the page and in the console do the moment() function and also within a render() function, but for some reason calling moment() within a callback function doesn't want to work..?
[18:19:01] fryguy: i once spent 6 hours tracking down what was ultimately a pluralized variable name. The letter 's' cost me several hours.
[18:34:27] baweaver: fryguy: it's the fate of all programmers to waste a few hours on silly mistakes every few months
[19:02:13] glassresistor: so im wanting to do something i know is hard to do in django/sqlalchemy/etc. and im pretty sure its hard in rails to but how do i do a polymorphic query accross multiple types of models
[19:04:06] glassresistor: so say i have Events which can be Messages or Photos or etc. so i want to have an event table with date, id, etc. and messages/photos have a fk to that and each there own columns. thats simple enough but now i want to query both messages and photos with all of there columns and loop over them in a template.
[19:05:27] arcturiaen: @glassresistor http://guides.rubyonrails.org/association_basics.html#polymorphic-associations
[19:05:32] glassresistor: is there any way to query all kinds of events(happen to list them all manually) and have them show up in a single properly interlaced list
[19:06:58] arcturiaen: https://gorails.com/episodes/comments-with-polymorphic-associations?autoplay=1
[19:10:47] arcturiaen: https://stackoverflow.com/questions/37391757/rails-query-related-to-polymorphic-association?rq=1
[19:27:04] glassresistor: arcturiaen: i've read both of those and this which looks a bit easier to follow: http://karimbutt.github.io/blog/2015/01/03/step-by-step-guide-to-polymorphic-associations-in-rails/
[19:29:07] glassresistor: arcturiaen: in section 2.9 from http://guides.rubyonrails.org/association_basics.html#polymorphic-associations it has an example with which seems like what I want except i just want Employees and Products to has_one picture if that makes sense?
[21:05:11] Prutheus: Hello. A Rails question: The application template has something like that `<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>` in it ... I also want to include all tempaltes and themes in the mailers template, but this line of code jsut embeds them relative, not absolute, so their path is /assets/.... and not https://www.domain.com/.....
[22:13:37] crowdpublishtv: Why are there huge left & right margins on Rails pages for all the content within <% yield %>? My headers take up the width of the entire browser. I googled this and cannot find any discussion about it, which makes me think I didn't use the correct search terms. I already checked stylesheets but body etc doesn't have margins set. I was able to get a sidebar all the way to the left but still have ridiculous padding betwe
[22:15:31] crowdpublishtv: Although I think I had huge margins/padding even before I installed bootstrap
[22:16:38] arcturiaen: apparently not if you dont know why you have margins, look at whats being applied with chrome dev tools or whatever dev tools for browser you use
[22:17:28] crowdpublishtv: arcturiaen: Is there anything in css that specifies different margins for content Inside <%= yield %> versus content outside <%=yield%>?
[22:18:43] arcturiaen: inspect it w/ browser dev tools and find the id or class applying the margins/padding
[22:25:35] crowdpublishtv: arcturiaen: the "class" applying margins/padding is everything within <%=yield%> on all pages. All headers, sidebars, and characters typed outside of <%=yield%> in layouts/templates have no margins within the browser
[22:29:48] arcturiaen: so when you inspect the content that is getting yielded from application layout or whatever layout is being applied, you can see the CSS ids or classes being applied to it from the inspector
[22:31:43] crowdpublishtv: The problem might be the Container class that bootstrap uses. But I removed <div class=container> and still have huge padding
[22:32:19] arcturiaen: https://usercontent.irccloud-cdn.com/file/BzLyFfzJ/chrome%20inspect%20see%20margin%2Fpadding