#RubyOnRails - 11 November 2017
« Back 1 day Forward 1 day »
[02:44:54] cam27: If I drop a column in psql is that the same as doing it in a migration? Could I not do so many migrations then if I’m comfortable with psql?
[02:45:31] fryguy: cam27: you can, but then you lose auditing and the ability to do rollbacks, and to coordinate the changes at release time
[02:54:09] cam27: I had a network issue, an upgrade to Postgres 10.1 from 9.6 issue and now I am trying to switch an old rails project over to use webpack and yarn instead of Bower and the Asset Pipeline. Switching my Jquerry stuff to React. I’m two for three so far today, but Front end stuff is not my best qualtiy lol
[02:56:22] cam27: I wanted to use Angular 4, but I’m not seeing a whole lot of free tutorials to work with yet online with Rails and Angular 4 (or 2) It all seems to be 1.5
[02:57:45] cam27: So I am thinking React, since Ember is for really big projects (according to my research) React is for small scale stuff, and Angular 1.5 is deprecated
[02:58:37] cam27: Just thinkng out loud, but what does the rails community siggest? Is Coffee and JQuerry going by the wayside?
[04:36:23] francuz: I'd say I probably have a typo in one of my config files somewhere, but how can i run a trace and find it ? and how can it be working on my laptop and not on my desktop? (both running same OS, RVM, ruby and rails)
[04:49:06] francuz: found it, a "*/" was missing at the end of one of the 50 precompiled .js . Still don't know why it was working on my laptop tho, and still don't know how I can track this kind of problem without going though each and every file of my asset folder ...
[05:32:03] matthewd: francuz: Yeah unfortunately some (most?) of the lower level libraries that support the asset pipeline aren't great at error reporting
[07:29:12] ali_g: Hi there. Has anyone consumed an API, which is actually a json served as an octect-stream application type?
[08:29:18] Andr3as: good morning.. i have an issue with using paperclip for "nested" attachments on a model while using dropzone.js for the file handling
[08:29:43] Andr3as: i get a NoMethodError - undefined method `' for #<ActionDispatch::Http::UploadedFile:0x00007f89b8fb34e0>:
[08:30:07] Andr3as: and am stuck.. googled back and forth but am unable to figure it out.. anyone an idea?
[09:09:29] yottanami: I have `:dependent => :destroy` in one of my models. now it destroied the records because of this relation. is it anyway to undelete?
[09:10:12] elomatreb: If they deleted in the database you can't unless you have backups (which you should)
[09:10:47] elomatreb: However if they were just soft-deleted (with a deleted_at column) you can probably just unset that
[15:26:40] xco: does doing `require ‘csv’` in application.rb make CSV available in ALL folderrs (even one i created myself) in Rails?
[15:28:25] dminuoso: xco: Yes. Ruby has no module infrastructure in the same sense that many other languages do.
[15:28:45] dminuoso: require is effectively just "execute this file and only hide the local variables from it"
[15:30:18] dminuoso: xco: The only reason you don't have to require your own files, is because Rails does it for you through autoloading.
[15:31:30] xco: ok reason i’m asking is i want i have a folder called “script” and in there are a bunch of files. like 50 files all requiring CSV, so i want to delete those require lines and have them in one place, application.rb
[15:31:49] xco: i’d like to know how this autoloading from application.rb to all files and folders work though
[15:32:23] dminuoso: xco: Eager loading is simple. It just recursively goes through some directories and requires each file once.
[15:32:29] dminuoso: xco: http://guides.rubyonrails.org/autoloading_and_reloading_constants.html for the second.
[15:36:23] xco: it says “Ruby looks for the file in the directories listed in $LOAD_PATH. “ when require is used
[15:37:52] dminuoso: xco: And essentially the difference between the stdlib and core is that stdlib has to be required
[16:30:42] dionysus69: is it good idea to handle every action with after_action :verify_authorized in pundit? even if it's index page without authorization. I would still prefer to have authorize in every action, if performance impact is negligible
[16:38:17] borodin: I'm having a durrrr moment. on mac sierra, trying to run 'bundle install' for the first time. I get "Could not reach host index.rubygems.org. Check your network connection and try again."
[16:38:39] borodin: I can wget http://index.rubygems.org and get a nice index file in the same terminal session
[16:39:50] borodin: (this laptop is a corporate laptop with an http proxy but I unset http_proxy, https_proxy)
[17:03:10] Vesther: Hello everyone, i've come in dire need of help, since it feels like i'm going insane :P
[17:05:25] Vesther: I'm trying to do a .where on a associated model in a rich association with a join table, but i want to return records based on join record attributes, not the target attributes
[17:07:14] Vesther: As in, having a model Foo and model Bar, as well as a join table "foobars", which contains a attribute like active:boolean, along with Foo has_many :bars, through: :foobars declared, i want to get all the Bars of a Foo where the relation record has :active => true
[17:28:04] jonash: with associations, how do I make a has_one with required: true not fail if the field is null? i.e. only validate the related table ID if it's not null
[17:29:30] andrewray: all of the cool kids seem to be using chruby over rvm, but is there *actually* a reason to hate rvm? I can't find anything online about why chruby is better
[17:30:44] jhass: jonash: well that's what required is for, maybe you're looking for validate: true?
[17:32:16] jhass: andrewray: chruby is simply doing a lot less, thus it integrates better into whatever setup you want rather than giving you only one sanctioned way to do things. Also it being simpler makes it easier to debug and reason about. But if RVM works well for you there's nothing wrong in sticking to it
[17:32:48] jonash: jhass: that doesn't seem to work, if I use required: false and validate: true and enter an invalid related ID I get a database-level foreign key constraint error
[18:12:13] andrewray: hmmm, rvm lets you do project specific gemsets, while chruby makes all gems global to that ruby version. seems like you'd obviously want project specific gemsets by default?
[18:15:09] andrewray: it's sad that the first result in google for "rvm vs chruby" is this http://kgrz.io/Programmers-guide-to-choosing-ruby-version-manager.html which is not helpful at all
[18:15:52] andrewray: and so many garbage links like https://blog.metova.com/choosing-a-ruby-version-management-tool still saying "rvm overwrites the cd command"
[18:16:11] andrewray: I haven't found any objective, good posts on this topic in the ruby community yet
[18:27:09] andrewray: ah, looks like bundler installs everything to the global ruby folder as well by default
[18:28:12] andrewray: I thought JS had it bad, I didn't realize all ruby tools default to global installs
[18:34:54] andrewray: lol even the chruby repo says it "doesn't hook cd" https://github.com/postmodern/chruby#anti-features
[19:11:38] francuz_: Hi all, I'd like to create a discord bot using rails and discordrb. I'd like to be able to have a chatbox on my website, and that it forward messages from discord to the chatbox basically. Making the bot(using the discordrb gem) and the chat(thinking about using action record) isn't that much of a problem (I think) but I'm wondering how I should connect them.
[19:11:56] francuz_: From what I know, I should define the "bot" and its functions in a file(don't know where), than "bot.run async" during server initialisation(don't know how), and have bot be a global variable. That way I would be able to use bot.send_message(Message) in the controller that is working with the chat.
[19:12:01] francuz_: Also, in the definition of the bot I should make an "event" that catches any message I send inside a channel, and that even should call a specific method to add the new message(don't know how to do that)
[19:12:09] francuz_: Not asking you to do it for me of course, just asking if the global idea is okey, or if I doing something totally wrong? and if you have any advice/answers/keywords I should search for before making it, it would be great.
[22:36:27] francuz_: Hi all, I'd like to create a discord bot using rails and discordrb. I'd like to be able to have a chatbox on my website, and that it forward messages from discord to the chatbox basically. Making the bot(using the discordrb gem) and the chat(thinking about using action record) isn't that much of a problem (I think) but I'm wondering how I should connect them.
[22:36:36] francuz_: From what I know, I should define the "bot" and its functions in a file(don't know where), than "bot.run async" during server initialisation(don't know how), and have bot be a global variable. That way I would be able to use bot.send_message(Message) in the controller that is working with the chat.
[22:36:42] francuz_: Also, in the definition of the bot I should make an "event" that catches any message I send inside a channel, and that even should call a specific method to add the new message(don't know how to do that)
[22:36:49] francuz_: Not asking you to do it for me of course, just asking if the global idea is okey, or if I doing something totally wrong? and if you have any advice/answers/keywords I should search for before making it, it would be great.