« Back to channel list

#RubyOnRails - 06 June 2017

« Back 1 day Forward 1 day »
[00:01:14] tweeeaks: has joined #RubyOnRails
[00:01:33] Trynemjoel: has joined #RubyOnRails
[00:02:47] centrx: has joined #RubyOnRails
[00:17:54] zzj: has joined #RubyOnRails
[00:41:29] bahamut24: has joined #RubyOnRails
[00:43:36] quazimodo: has joined #RubyOnRails
[00:44:52] r3vDev: has joined #RubyOnRails
[00:54:51] sevenseacat: has joined #RubyOnRails
[00:58:54] psylone: has joined #RubyOnRails
[01:00:17] nesoi: has joined #RubyOnRails
[01:01:36] nesoi: I'm trying to run an old Rakefile and get the error: Directly inheriting from ActiveRecord::Migration is not supported. Please specify the Rails release the migration was written for. What do I need to do to make it work?
[01:02:31] sevenseacat: edit the migration file to specify eg. < ActiveRecord::Migration[5.0] (if it was written for rails 5)
[01:03:07] nesoi: sevenseacat: it's not a rails app, just a small program that uses activerecord, and I have no idea what version it used
[01:03:35] nesoi: how do I specify a version?
[01:03:59] nesoi: the error message says 4.2 so maybe it knows
[01:04:48] sevenseacat: well activerecord is the same version system as rails, so
[01:06:16] nesoi: so how do I specify the version within the rakefile?
[01:06:48] nesoi: currently it just has:
[01:06:49] nesoi: require 'active_record'
[01:06:49] nesoi: require 'active_support/all'
[01:06:52] Technodrome: has joined #RubyOnRails
[01:08:17] sevenseacat: you dont specify any versions there
[01:08:46] nesoi: ok, in the migrations, how do I specify it?
[01:09:21] sevenseacat: edit the migration file to specify eg. < ActiveRecord::Migration[5.0] (if it was written for rails 5)
[01:09:41] nesoi: right, how do I specify that?
[01:10:11] sevenseacat: edit the first line of the migration to add that [5.0] versioning
[01:11:28] duderonomy: has joined #RubyOnRails
[01:11:54] nesoi: cool, worked. thanks!
[01:13:56] zzj: has joined #RubyOnRails
[01:16:50] Radar: zzj: fascinating. Please continue.
[01:20:10] drale2k_: has joined #RubyOnRails
[01:34:00] timdotrb: has joined #RubyOnRails
[01:46:44] tanuki: has joined #RubyOnRails
[01:51:37] peterhil: has joined #RubyOnRails
[01:52:27] zzj: has joined #RubyOnRails
[01:56:57] robnester: has joined #RubyOnRails
[02:05:01] quazimodo: has joined #RubyOnRails
[02:05:22] irishfromua: has joined #RubyOnRails
[02:10:45] urkle: has joined #RubyOnRails
[02:16:26] harfangk: has joined #RubyOnRails
[02:22:16] urkle: has joined #RubyOnRails
[02:23:47] byteflame: has joined #RubyOnRails
[02:26:19] byteflame: has joined #RubyOnRails
[02:33:44] aajjbb: has joined #RubyOnRails
[02:38:23] timdotrb: has joined #RubyOnRails
[02:42:30] Jayson_Virissimo: has joined #RubyOnRails
[02:52:39] ElFerna: has joined #RubyOnRails
[02:59:34] Derperperd: has joined #RubyOnRails
[03:14:37] psylone: has joined #RubyOnRails
[03:18:21] urkle: has joined #RubyOnRails
[03:25:04] railsnewbie12: has joined #RubyOnRails
[03:27:05] railsnewbie12: I am new to rails, and I have a very basic question. I have this app I started to make, where a user can sign up. But a user is not able to post until they have completed adding information to their account (ex. Birthday). I know I would have to check if they birthday coulmn is not nil in the DB, but I am not sure how to actually go about that. I write that code in the model, and then I would have the controller call it. Bu
[03:32:28] duderonomy: has joined #RubyOnRails
[03:34:22] urkle: has joined #RubyOnRails
[03:39:00] xx00__: has joined #RubyOnRails
[03:51:47] nesoi: has joined #RubyOnRails
[03:54:03] Radar: railsnewbie12: hi
[03:54:09] Radar: railsnewbie12: Your sentence was cut off at "Bu"
[03:57:51] tanuki: has joined #RubyOnRails
[04:12:30] duderonomy: has joined #RubyOnRails
[04:15:19] psylone: has joined #RubyOnRails
[04:16:13] theunraveler: has joined #RubyOnRails
[04:17:12] robnester: has joined #RubyOnRails
[04:26:39] tanuki: has joined #RubyOnRails
[04:27:13] robnester: has joined #RubyOnRails
[04:31:10] Technodrome: has joined #RubyOnRails
[04:53:38] tanuki: has joined #RubyOnRails
[04:56:05] zzj: has joined #RubyOnRails
[05:03:39] tanuki: has joined #RubyOnRails
[05:06:59] urkle: has joined #RubyOnRails
[05:08:43] ascarter: has joined #RubyOnRails
[05:11:43] Technodrome: has joined #RubyOnRails
[05:15:24] quazimodo: has joined #RubyOnRails
[05:15:35] tanuki: has joined #RubyOnRails
[05:29:01] urkle: has joined #RubyOnRails
[05:41:08] timdotrb: has joined #RubyOnRails
[05:41:13] timdotrb: Evening, all
[05:42:40] timdotrb: I’m seeing an issue in the logs for an app that I’ve inherited, and there’s a POST request to a route that’s defined as a GET request. I’ve searched the code and don’t see anywhere that would make it POST to that path
[05:43:14] timdotrb: Since I don’t see it in the code, and can’t glean how the users are getting to that path from the logs, I’m wondering if I should just define a route that redirects the POST to a GET?
[05:48:11] sevenseacat: I don't think that would be wise
[05:49:11] toggle_: has joined #RubyOnRails
[05:52:21] sevenseacat: unless you have some savvy users, they aren't making POST requests themselves, they're making them via your app
[05:53:16] sevenseacat: checking logs, can't you see where they came from before making that POST request?
[05:54:22] Radar: Probably not from the logs. If you logged a referrer you might be able to figure it out.
[05:54:34] urkle: has joined #RubyOnRails
[06:08:18] srinidhi: has joined #RubyOnRails
[06:09:47] roshanavand: has joined #RubyOnRails
[06:12:05] urkle: has joined #RubyOnRails
[06:16:11] psylone: has joined #RubyOnRails
[06:26:11] nesoi: has joined #RubyOnRails
[06:35:25] timdotrb: That is the weird part
[06:36:08] timdotrb: I see a GET request for /cart/checkout , and then (in this particular user’s case), I see a POST request about 5 minutes later to /cart/checkout
[06:36:37] irishfromua: has joined #RubyOnRails
[06:36:57] timdotrb: I can follow the user as they select products and then go to the cart.
[06:37:17] timdotrb: As far as I can tell, there is always a GET /cart/checkout before there is a POST /cart/checkout
[06:37:18] sevenseacat: so what was the request immediately before the post?
[06:37:42] sevenseacat: so is there a form on that page that posts to itself?
[06:38:36] sevenseacat: a search maybe, or an update cart, or something like that?
[06:38:47] sevenseacat: or an apply coupon
[06:39:48] timdotrb: No coupon.. The form submits a POST to /cart/order
[06:40:13] timdotrb: And you can’t change the quantity from the checkout page, you have to do it from the cart page
[06:41:26] sevenseacat: well following the breadcrumbs would make me think there must be a form on this page somewhere
[06:41:37] sevenseacat: that either has no action specified, or specifies the current path
[06:42:48] conta: has joined #RubyOnRails
[06:45:03] timdotrb: Here’s the code for the checkout page & it’s associated routes: https://gist.github.com/willc0de4food/4892e990184aa694000df92cc1576595
[06:47:40] armyriad: has joined #RubyOnRails
[06:47:40] timdotrb: Continuing the strange behavior: this only happens rarely, not on every request. Sometimes I’ll see the POST request multiple times in a row
[06:47:43] timdotrb: The reason I’m even looking into this issue is that my client (who owns the website) is getting multiple orders submitted for random users. The users have been reporting no strange behavior
[06:47:43] timdotrb: On the form, I have the submit button disable on click.
[06:47:44] timdotrb: When I look at the logs, I see multiple submits at the exact same second
[06:47:59] sevenseacat: smells like turbolinks firing off multiple requests at once
[06:48:39] sevenseacat: which I've seen many many times before, when JS event handlers arent written with turbolinks in mind
[06:49:04] arup_r: has joined #RubyOnRails
[06:49:50] timdotrb: And the plot thickens: this app doesn’t have turbolinks
[06:50:02] timdotrb: Ex of multiple submits: https://gist.github.com/willc0de4food/534138b6569484f27b593db264443a34
[06:50:22] timdotrb: Gemfile: https://gist.github.com/willc0de4food/f94c426b5038fd090a89ac08c3b7c3c9
[06:50:58] Sirecote: has joined #RubyOnRails
[06:51:29] sevenseacat: nothing in there leaps out at me
[06:51:36] timdotrb: I know, right?
[06:52:09] arup_r: what is the issue? :)
[06:52:43] r3vDev: has joined #RubyOnRails
[06:52:55] Radar: timdotrb: You can include multiple files in the same gist btw.
[06:53:18] timdotrb: Radar: Yea, I was considering editing the same gist, but wasn’t sure if it would be incoherent
[06:53:54] timdotrb: arup_r: I have a client with an older rails app that’s getting orders submitted twice intermittently. I’m also getting POST requests to a route that doesn’t exist in my app
[06:55:13] timdotrb: My next thought as a solution to this problem is to add a before_save callback to check if an order exists with a user’s email address created within the last minute
[06:55:31] dionysus69: has joined #RubyOnRails
[06:55:32] timdotrb: Doesn’t help me to figure out how the issue is occurring, but it might stop duplicate orders
[06:55:53] arup_r: timdotrb: can you reproduce it in development or it is only happening in production?
[06:55:54] timdotrb: However, with the form submitting twice in the same second, would this callback be effective?
[06:56:25] timdotrb: arup_r: I am unable to reproduce it. It doesn’t happen often at all, and the users don’t report any strange behavior while using the app
[06:56:57] byteflame: has joined #RubyOnRails
[06:57:54] timdotrb: I could also start tracking user agents to see if it’s a specific browser that’s making the issue occur
[06:58:05] arup_r: timdotrb: in past I faced something like this due to duplicate inclusion of jquery.. You can check the network tab of browser to check *initiate* column...
[06:59:37] timdotrb: arup_r: The only JS I see loading is the application-hash.js
[06:59:51] sevenseacat: does it include jquery more than once?
[07:00:40] timdotrb: It has: jquery.min, jquery_ujs, jquery.cookie, require_directory
[07:01:08] arup_r: timdotrb: I hope you are on chrome, because that is the best for me when debugging. :)
[07:01:12] timdotrb: And then in the directory, there is jquery
[07:01:20] timdotrb: arup_r: That I am :)
[07:01:22] sevenseacat: score one for arup_r
[07:01:29] timdotrb: So do you think that’s the issue?
[07:01:33] arup_r: thanks sevenseacat.
[07:01:36] arup_r: timdotrb: yes
[07:01:47] arup_r: just make sure load one and test again.
[07:02:12] arup_r: I solved it before it by making sure I have only 1 Jquery lib
[07:02:36] timdotrb: Should I explicitly include each js in the directory?
[07:04:59] zzj: has joined #RubyOnRails
[07:05:32] arup_r: timdotrb: how many menifest files you have?
[07:06:07] timdotrb: arup_r: there’s CSS manifest files, but none for js
[07:07:02] mahloun: has joined #RubyOnRails
[07:07:57] arup_r: I mean only application.js is being used for whole app..?
[07:08:20] arup_r: Rails 3 I have few experience though.. :)
[07:08:40] pwnd_nsfw: Oh, wasn't here for that detail
[07:09:18] timdotrb: Application.js is it
[07:09:32] pwnd_nsfw: I was still a pleb when rails 3 was around, started getting better when I was using 4
[07:11:00] pwnd_nsfw: pleb, noob,
[07:11:18] timdotrb: I started back with good ol’ rails 2
[07:11:27] pwnd_nsfw: I was still using php
[07:11:37] timdotrb: Lol that’s where I came from as well
[07:11:39] pwnd_nsfw: Although, I'm glad I found rails when i did
[07:11:45] timdotrb: The whole stateless database connection blew my mind
[07:12:04] pwnd_nsfw: I just wish I had started ruby earlier. "yield" actually turned me off from it because I didn't exactly understand it lol
[07:13:30] timdotrb: Yea, I can relate. I had a plethora of issues with the first tutorial I tried following
[07:15:17] arup_r: i started from Rails 4.
[07:16:39] sevenseacat: I started with Rails 3.0.3 :)
[07:17:29] ur5us: has joined #RubyOnRails
[07:18:00] timdotrb: I bet Radar started when you had to walk 5 miles uphill both ways in the snow ;)
[07:18:19] arup_r: sevenseacat: these days are you using Phoenix and Elixir? Or still in Rails?
[07:18:30] sevenseacat: Rails for work, Elixir for side projects.
[07:18:44] timdotrb: One of my coworkers has been studying up on that
[07:19:05] sevenseacat: i rather like elixir. pattern matching is a revelation.
[07:19:05] timdotrb: Does it do something better?
[07:20:00] arup_r: ok.. sevenseacat you had previous knowledge of FP? I tried Elixir, and I didn't understand the FP :) I need to *retry* sometime
[07:20:29] sevenseacat: very little. I did a bit back in uni, but that was over a decade ago
[07:21:21] arup_r: but I am happy with Rails so far..
[07:21:33] sevenseacat: if you're happy with it, stick with it. it isnt going anywhere.
[07:23:20] User458764: has joined #RubyOnRails
[07:23:44] arup_r: sevenseacat: thanks for giving me the confidence ... :) I really would like to work with this next 10 years :D I am interested in projects after 5.1 with some fancy JS mixed into Rails.. React/Vue etc.. Lets see when it happens.. I am enjoying Ruby and JS both. because both of them are dynamic :)
[07:24:13] arup_r: timdotrb: is your problem solved now? :)
[07:24:52] timdotrb: arup_r: I’m not sure.. I’ve implemented the change to application.js, and I added a logger line to log user agents for orders that are submitted
[07:25:10] timdotrb: If the problem persists, I will at least know that jquery isn’t the issue, and I’ll have more information to go off of
[07:26:17] arup_r: ok.. but did you check Network tab initiator column, it tells the source of each request.
[07:26:35] arup_r: well good luck then.. let me know if the issue still there :)
[07:29:31] timdotrb: It’s still precompiling the assets >.>
[07:29:36] timdotrb: I have no clue why it’s taking so long
[07:30:04] timdotrb: I wish I could upgrade this app to current ruby / rails, but that would be a pretty hefty undertaking
[07:30:21] drale2k_: has joined #RubyOnRails
[07:30:27] timdotrb: Actually my ssh session froze
[07:30:29] timdotrb: So that’s great
[07:31:44] timdotrb: Ty all for the help :) hopefully we’ve somehow squashed this bug..
[07:36:09] arup_r: has joined #RubyOnRails
[07:37:56] mtkd: has joined #RubyOnRails
[07:38:11] arup_r: timdotrb: 👍
[07:38:42] urkle: has joined #RubyOnRails
[07:42:14] cgfbee: has joined #RubyOnRails
[07:58:02] ferr1: has joined #RubyOnRails
[07:58:32] mikecmpbll: has joined #RubyOnRails
[08:09:19] drale2k_: has joined #RubyOnRails
[08:17:11] psylone: has joined #RubyOnRails
[08:20:08] nalread: has joined #RubyOnRails
[08:25:31] mikecmpb_: has joined #RubyOnRails
[08:25:47] sandstrom: has joined #RubyOnRails
[08:30:02] srinidhi: has joined #RubyOnRails
[08:51:53] DrYockel: has joined #RubyOnRails
[08:56:05] shotbug: has joined #RubyOnRails
[08:56:16] kies: has joined #RubyOnRails
[08:57:21] byteflame: has joined #RubyOnRails
[08:58:12] dionysus69: has joined #RubyOnRails
[09:05:28] lxsameer: has joined #RubyOnRails
[09:07:32] brent__: has joined #RubyOnRails
[09:11:56] shotbug: has joined #RubyOnRails
[09:15:18] arup_r: has joined #RubyOnRails
[09:16:50] boxmein: has joined #RubyOnRails
[09:19:26] Pumukel: has joined #RubyOnRails
[09:26:24] Cork: has joined #RubyOnRails
[09:33:59] Cork: has joined #RubyOnRails
[09:39:09] jjaii9: has joined #RubyOnRails
[09:47:14] ur5us: has joined #RubyOnRails
[09:51:42] acosonic: has joined #RubyOnRails
[10:04:54] urkle: has joined #RubyOnRails
[10:06:56] arBmind: has joined #RubyOnRails
[10:12:18] arup_r: has joined #RubyOnRails
[10:29:52] jsvgoncalves: has joined #RubyOnRails
[10:42:00] byteflame: has joined #RubyOnRails
[10:43:22] Technodrome: has joined #RubyOnRails
[10:43:38] psylone: has joined #RubyOnRails
[10:46:27] arup_r: has joined #RubyOnRails
[10:46:43] arup_r: I am trying to test grape api.. but from spec the request is not coming to my rails as I don't see it in logs/test.log file. What am I missing? https://gist.github.com/aruprakshit/3883ea669ba8ef5ad8dd91fa94cda025 . Official doc https://github.com/ruby-grape/grape#writing-tests
[10:57:28] byteflame: has joined #RubyOnRails
[11:01:34] workmad3: arup_r: how are you mounting the grape API?
[11:01:47] arup_r: workmad3: let me add it
[11:02:38] arup_r: workmad3: https://gist.github.com/aruprakshit/3883ea669ba8ef5ad8dd91fa94cda025#file-api-rb
[11:12:19] zzj: has joined #RubyOnRails
[11:22:34] arBmind: has joined #RubyOnRails
[11:23:41] normie1: has joined #RubyOnRails
[11:28:03] Fernando-Basso: has joined #RubyOnRails
[11:28:35] marr: has joined #RubyOnRails
[11:31:02] dionysus69: has joined #RubyOnRails
[11:38:45] ElFerna: has joined #RubyOnRails
[11:43:37] zzj: has joined #RubyOnRails
[11:49:29] HoierM: has joined #RubyOnRails
[11:51:56] brent__: has joined #RubyOnRails
[11:55:03] shotbug: has joined #RubyOnRails
[11:56:33] urkle: has joined #RubyOnRails
[12:01:27] Coldblackice: has joined #RubyOnRails
[12:03:23] srinidhi: has joined #RubyOnRails
[12:03:54] Coldblackice: has joined #RubyOnRails
[12:04:32] Coldblackice: has joined #RubyOnRails
[12:05:10] Coldblackice: has joined #RubyOnRails
[12:06:52] Coldblackice: has joined #RubyOnRails
[12:08:13] ElFerna: has joined #RubyOnRails
[12:08:27] aajjbb: has joined #RubyOnRails
[12:12:41] AzaToth: has joined #RubyOnRails
[12:20:02] rgr: has joined #RubyOnRails
[12:22:19] zzj: has joined #RubyOnRails
[12:23:47] charlielor: has joined #RubyOnRails
[12:24:11] charlielor: I’ve created an api.rb in the lib folder and I’m trying to run it in ruby console to see if it actually pulls in data from an api call but it didn’t work. Any suggestions?
[12:25:54] charlielor: In the api.rb class I have defined a def self.get_tag method and when I have: all_tag = api.new puts all_tag.get_tag, it didn’t show me anything
[12:26:16] charlielor: This is a ruby on rails app but I’m testing to see if it actually pulls in the data first.
[12:30:28] pupsicle: has joined #RubyOnRails
[12:34:38] ElFerna: has joined #RubyOnRails
[12:36:26] srinidhi: has joined #RubyOnRails
[12:36:56] quazimodo: has joined #RubyOnRails
[12:44:55] universa1: charlielor: without seeing your code it is basically impossible to help you.
[12:46:08] charlielor: universa1: this is the tutorial I’m following: http://eric-price.net/blog/rails-api-wrapper/
[12:47:19] charlielor: However, instead of Wunderground.rb I named ny api.rb and use a puts to see if I can get some data first before creating a view and controller for it.
[12:48:52] charlielor: instead of get_weather, I have get_tag
[12:49:03] ikoma: has joined #RubyOnRails
[12:49:52] fschuindt1: has joined #RubyOnRails
[12:57:42] byteflame: has joined #RubyOnRails
[12:58:45] xx00__: has joined #RubyOnRails
[13:03:29] dionysus69: what's the conventional library for making http requests from rails app? so far I got started with Net:HTTP, wonder if there's no sophisticated lib
[13:11:25] deur-: dionysus69: I like RestClient, mostly because it handles multipart form submits fairly well
[13:12:24] deur-: but otherwise, depends on your needs and what you mean by sophisticated I suppose. :-)
[13:12:27] shotbug: has joined #RubyOnRails
[13:13:01] dionysus69: for example atm I am using http requests for just sending a simple request to send sms for phone verification
[13:13:16] dionysus69: but soon I will need to parse another API with my rails app
[13:13:38] dionysus69: xml api, I would need something to fetch the xml file and then use nokogiri to parse it?
[13:16:30] deur-: dionysus69: pretty much. the fetching can be done with Net::HTTP, Curb, or RestClient, whichever you prefer
[13:16:58] tomasm-: has joined #RubyOnRails
[13:17:10] dionysus69: ok thanks deur-! I will have a restful sleep xD
[13:21:36] tomasm-: hey I noticed if i'm trying to load a partial with just one part to the name (not in a subfolder), it tries loading it from app/views/CONTROLLER and app/views/application .... any idea if I can get that same mechanism working if I have nested paths? ie, "render 'nav/links', only loads from app/views/nav/_links.... I'd like to have my app also look in app/views/application/nav/_links .... but maybe the answer is to just put my s
[13:21:36] tomasm-: tuff into a gem so I can override it locally in my app
[13:25:24] charlielor: I’m using RubyMine and when I mouse over the require ‘httparty’, it shows this: This inspection warns about the references in Ruby code which can't be resolved to any valid target. This most likely indicates a typo or some other error which may occur at runtime. The IDE highlights all the symbols in the code which cannot be found anywhere within your project and most likely they should be treated as incorrect ones.
[13:32:04] DLSteve: has joined #RubyOnRails
[13:34:34] sandstrom: has joined #RubyOnRails
[13:41:38] byteflame: has joined #RubyOnRails
[13:48:42] uksio: has joined #RubyOnRails
[13:59:03] charlielor: So, any idea why I can’t run the .rb file as a ruby file?
[14:02:51] chouhoulis: has joined #RubyOnRails
[14:04:34] tbuehlmann: charlielor: can you gist the file? how do you run the file?
[14:06:30] charlielor: the .rb file is inside the lib foler so at the app root folder, I do: ruby lib/api.rb
[14:07:09] charlielor: and nothing happens besides it keeps going into my Rubymine api.rb file and stops there
[14:07:56] tbuehlmann: I would start up a rails console ($ bin/rails console) and call the method there
[14:07:59] charlielor: is nothing much inside the api.rb file. At the top I have require ‘rubygems’ and require ‘httparty’ then the class KoApi and include HTTParty
[14:08:28] tbuehlmann: I assume you will use the class/module in your application?
[14:09:29] charlielor: this is the tutorial I’m following: https://youtu.be/mwtKQlu7a08?list=PLS-X3A6Dr2qPXTSxMf6XPiO9HCkJLe51z
[14:09:47] charlielor: I’m using class KoAPI
[14:10:23] charlielor: after the end of the class, I do: all_tag = KoAPI.new and then puts all_tag.posts
[14:10:30] tbuehlmann: the tutorial you're following uses plain ruby. in rails, you want to follow certain conventions so you get all the niceties
[14:10:44] charlielor: so at the terminal I ran: ruby lib/api.rb
[14:10:56] tbuehlmann: like: the file name should be named after the constant you're defining in that file
[14:11:29] charlielor: basically I was tring to see if it actually works first, once it works, I’m also following this tutorial: http://eric-price.net/blog/rails-api-wrapper/
[14:11:54] charlielor: but before I start the controller and view, I like to know if it’ll work first by printing it on screen
[14:12:04] tbuehlmann: yeah, that's a good thing to do
[14:12:42] aajjbb: has joined #RubyOnRails
[14:12:51] tbuehlmann: can you paste your code at https://gist.github.com/?
[14:12:54] tbuehlmann: makes things easier
[14:14:56] charlielor: Okay, see if this link works: https://gist.github.com/anonymous/7d104b9802fa5f1648e7df7d09cd832a
[14:16:44] tbuehlmann: okay, so, what I'd do: name the file ko_api.rb
[14:17:36] tbuehlmann: next, add the following to your config/application.rb: config.eager_load_paths << config.root / 'lib'
[14:18:33] tbuehlmann: after that, start up a rails console ($ bin/rails console) and check what happens when you enter `KoApi`
[14:19:54] tbuehlmann: oh, and remove the first two lines from ko_api.rb, you don't need to require rubygems or httparty. just make sure your Gemfile lists the httparty gem
[14:21:57] ElFerna: has joined #RubyOnRails
[14:22:05] tbuehlmann: also: don't forget to not quit the irc so you can read what people write
[14:23:24] charlielor: has joined #RubyOnRails
[14:23:55] charlielor: tbuehlmann: sorry I got disconnected
[14:24:16] tbuehlmann: yeah, I noticed
[14:24:19] tbuehlmann: see https://gist.github.com/tbuehlmann/b7336bbbd3ce7ba65901bffa10d9ede9
[14:26:26] charlielor: okay, thanks! I’ll make that adjustments and test out…will report back.
[14:28:30] conta: has joined #RubyOnRails
[14:31:11] mikecmpb_: has joined #RubyOnRails
[14:32:32] shotbug: has joined #RubyOnRails
[14:33:49] dionysus69: has joined #RubyOnRails
[14:37:15] patarr: has joined #RubyOnRails
[14:37:56] charlielor: tbuehlmann: I have the error: ArgumentError: wrong number of arguments (given 0, expected 1)
[14:38:30] charlielor: Is there a way I can paste in the whole error?
[14:38:32] tbuehlmann: you got that methods wrong, but we're going there
[14:38:46] tbuehlmann: remove the last two lines from your ko_api.rb, we don't need them
[14:39:09] tbuehlmann: after that, enter "reload!" in your rails console
[14:43:05] charlielor: Okay, after I typed in KoApi and hit enter, it shows: => KoApi
[14:43:13] charlielor: no errors but it just shows that
[14:43:19] tbuehlmann: great, that's all we wanted
[14:43:34] tbuehlmann: you can now play around with your class
[14:43:51] tbuehlmann: whenever you change the file, hit "reload!" in the console to reload the code
[14:44:02] NickR7734: has joined #RubyOnRails
[14:44:24] charlielor: okay, so how do I verify if it actually pulls data from the api calls?
[14:45:05] tbuehlmann: um, you could actually use the class
[14:45:25] charlielor: can I just call the class method?
[14:46:01] tbuehlmann: you call class methods on the class, like KoApi.get_tag
[14:46:39] charlielor: Okay, that shows this error: SocketError: Failed to open TCP connection to app.knowledgeowl.comapi:80 (getaddrinfo: nodename nor servname provided, or not known)
[14:48:24] tbuehlmann: app.knowledgeowl.comapi:80 looks wrong
[14:49:09] tbuehlmann: just to be sure: can you remove the trailing slash from the base_uri and try again?
[14:49:13] charlielor: In the base_uri do I need to specify the ‘https’?
[14:49:59] charlielor: If i removed the trailing slash at the app.knowledgeowl.com then do I have to add that to the response=get()
[14:53:26] ElFerna: has joined #RubyOnRails
[14:54:59] mikecmpbll: has joined #RubyOnRails
[14:56:55] charlielor: tbuehlmann: got to this now: => #<KoApi:0x007f97cbe5b950 @id=nil, @name=nil>
[14:57:16] charlielor: no errors but no data, is my initialize wrong?
[15:07:39] SilentNinja1: has joined #RubyOnRails
[15:09:07] SilentNinja1: Hi Besides adding the 2 gems rails_semantic_logger and awesome_print, what else I need to change in order to get Semantic Logger working with Nginx/Passenger for RoR app? Thanks
[15:10:11] ElFerna: has joined #RubyOnRails
[15:11:44] mikecmpbll: has joined #RubyOnRails
[15:14:18] tbuehlmann: charlielor: you could request the page manually and check the response
[15:16:55] charlielor: tbuehlmann: how do request the page manually?
[15:17:00] mikecmpb_: has joined #RubyOnRails
[15:17:44] barhum2013: has joined #RubyOnRails
[15:21:45] my123_: has joined #RubyOnRails
[15:23:53] SilentNinja1: anyone familiar with Semantic Logger for RoR?
[15:24:09] tbuehlmann: charlielor: how does the class make the request?
[15:24:31] rromanchuk: has joined #RubyOnRails
[15:25:03] arBmind: has joined #RubyOnRails
[15:25:54] charlielor: To be honest, I’m not sure. I’m following this tutorial: http://eric-price.net/blog/rails-api-wrapper/
[15:26:37] tbuehlmann: have you read the code of your KoApi class?
[15:28:18] charlielor: Wan’t this line suppose to make the api call request? response = get("/api/head/tag.json?project_id=55c4ffd132131c527e294fe6&_authbykey=#{ENV["knowledge_owl_key"]}&status=active")
[15:29:31] kies: has joined #RubyOnRails
[15:33:00] tbuehlmann: right, that sends a GET request to that path and returns a response object. you could play with that response object a bit and check what method it has and what data came back
[15:33:33] Kneecaps: has joined #RubyOnRails
[15:38:25] ascarter: has joined #RubyOnRails
[15:38:30] charlielor: Okay, so basically the “response” returned from the request is a object and I have to have a way of printint/outputing the actual data from this object, correct?
[15:39:20] brent__: has joined #RubyOnRails
[15:40:33] hobodave: has joined #RubyOnRails
[15:41:47] PresidentBiscuit: has joined #RubyOnRails
[15:43:34] tbuehlmann: I prefer debugging code using pry-rails, maybe check that out
[15:43:43] charlielor: that answers the question @id and @name is nil. Okay, so then what exactly is the def initialize(response) method and attr_accessor :id, :name do then?
[15:44:12] charlielor: Are they just setup for the controller to call and further manipulate the data?
[15:45:07] tbuehlmann: they offer getters and setters for when you want to use the api object
[15:45:36] tbuehlmann: #initialize is the constructor method that is called when you call .new
[15:46:31] charlielor: awesome, thank you!
[15:55:03] Jayson_Virissimo: has joined #RubyOnRails
[15:58:44] sloggerkhan: has joined #RubyOnRails
[16:00:40] dionysus69: has joined #RubyOnRails
[16:00:43] zzj: has joined #RubyOnRails
[16:04:26] mahloun: has joined #RubyOnRails
[16:06:57] timdotrb: has joined #RubyOnRails
[16:07:55] Coldblackice: has joined #RubyOnRails
[16:08:55] msantan: has joined #RubyOnRails
[16:09:43] statu: has joined #RubyOnRails
[16:10:28] statu: Hi! I have a doubt about Capistrano. I'm not sure if this is the correct place. If it isn't, sorry!
[16:10:37] statu: I have Rake task imported. If I run `cap -T` I can see it but I want to run it as part of the deploys. Just before deploy:updated. I tried adding Rake::Task['deploy:updated'].prerequisites.push('my:task') in deploy.rb but it does not execute it.
[16:12:10] Cache_Money: has joined #RubyOnRails
[16:12:50] roshanavand: has joined #RubyOnRails
[16:18:23] xx00__: has joined #RubyOnRails
[16:20:26] urkle: has joined #RubyOnRails
[16:29:29] charlielor: has joined #RubyOnRails
[16:41:21] sandstrom: has joined #RubyOnRails
[16:41:28] Kneecaps: has left #RubyOnRails: ()
[16:42:24] fryguy: statu: use `before 'deploy:updated', 'my:task'`
[16:48:03] arup_r: has joined #RubyOnRails
[16:49:25] marr: has joined #RubyOnRails
[16:50:02] [Butch]: has joined #RubyOnRails
[16:53:31] statu: thank you fryguy!!!
[16:57:28] bga57: has joined #RubyOnRails
[16:58:17] arup_r: has joined #RubyOnRails
[16:58:28] Frem: has joined #RubyOnRails
[17:00:27] ahrs: has joined #RubyOnRails
[17:01:11] hahuang65: has joined #RubyOnRails
[17:14:15] barhum2013: has joined #RubyOnRails
[17:15:33] Nick7734: has joined #RubyOnRails
[17:23:42] gusrub: has joined #RubyOnRails
[17:24:02] nickjj_: has joined #RubyOnRails
[17:24:53] codezomb: has joined #RubyOnRails
[17:27:20] charlielor: has joined #RubyOnRails
[17:32:40] arBmind: has joined #RubyOnRails
[17:42:46] francuz: hello everyone,
[17:43:06] ikoma: has joined #RubyOnRails
[17:46:44] duderonomy: has joined #RubyOnRails
[17:49:16] francuz: I'm trying to reorganise rails apps of a firm using Docker containers, but most posts I see online speak about having a docker-compose including a Postgres container, a Nginx container and a rails container, for each rails app. I'm totally fine with having 5 rails container for 5 apps, 5 Postgres container for 5 apps (though it looks like it would consume a lot of unnecessary resources), but having 5 Nginx
[17:49:16] francuz: containers for 5 apps really looks clumsy for me. I'm kinda new to the web-dev world, and it might be just me, but as it looks strange I preferred asking before losing a lot of time doing something the wrong way.
[17:52:57] [Butch]_: has joined #RubyOnRails
[17:53:14] jobewan: has joined #RubyOnRails
[17:53:45] [Butch]_: has joined #RubyOnRails
[17:55:09] jdqx_: has joined #RubyOnRails
[17:58:16] Technodrome: has joined #RubyOnRails
[17:59:56] rakm: has joined #RubyOnRails
[18:01:28] arup_r: has joined #RubyOnRails
[18:17:10] mrbubbles: has joined #RubyOnRails
[18:17:14] mrbubbles: Good evening :)
[18:26:24] tercenya: has joined #RubyOnRails
[18:26:36] masscrx: has joined #RubyOnRails
[18:27:17] Aherin: has joined #RubyOnRails
[18:28:24] masscrx: I have a strange problem with rake, I have defined rake task and when I invoke by command line task runs correctly, but when I'm trying to run that task from model callback then there is no action
[18:29:28] masscrx: Rake::Task["crm:db:migrate"].execute() - NoMethodError: undefined method `db_user' for nil:NilClass and thas fine I can see that task is invoking
[18:30:01] masscrx: but when Rake::Task["crm:db:migrate"].invoke() - then no errors, no logs, nothing, just no action
[18:30:03] mikecmpbll: has joined #RubyOnRails
[18:30:26] masscrx: any ideas ?
[18:31:00] masscrx: I was trying system("rake crm:db:migrate database_name=#{db_name}") but resulted some errors
[18:38:55] arup_r: so from model, you are trying to db db:migrate? Your schema is dynamic ?? 🙄
[18:39:07] masscrx: yes my schema is dynamic
[18:39:39] masscrx: I can run migrations for specific database passed as argument
[18:42:31] dionysus69: has joined #RubyOnRails
[18:43:53] srinidhi: has joined #RubyOnRails
[18:44:19] tjbiddle: has joined #RubyOnRails
[18:44:39] cjhowe7: has joined #RubyOnRails
[18:45:16] mahloun: has joined #RubyOnRails
[18:51:45] pLaTo0n: has joined #RubyOnRails
[18:52:23] arup_r: has joined #RubyOnRails
[18:54:15] arup_r1: has joined #RubyOnRails
[18:59:30] arup_r: has joined #RubyOnRails
[19:01:18] mimico: has joined #RubyOnRails
[19:01:46] hobodave_: has joined #RubyOnRails
[19:02:36] SteenJobs_: has joined #RubyOnRails
[19:14:46] nesoi: has joined #RubyOnRails
[19:18:05] HoierM: has joined #RubyOnRails
[19:24:02] kies: has joined #RubyOnRails
[19:25:15] ur5us: has joined #RubyOnRails
[19:30:16] sandstrom: has joined #RubyOnRails
[19:36:54] ikoma: has joined #RubyOnRails
[19:40:36] mahloun: has joined #RubyOnRails
[19:49:06] kies: has joined #RubyOnRails
[19:49:53] centrx: has joined #RubyOnRails
[19:51:50] arBmind: has joined #RubyOnRails
[19:51:56] drale2k_: has joined #RubyOnRails
[19:57:51] gambl0re: has joined #RubyOnRails
[20:00:02] dionysus69: has joined #RubyOnRails
[20:03:18] hobodave: has joined #RubyOnRails
[20:05:40] arBmind: has joined #RubyOnRails
[20:06:57] SteenJobs: has joined #RubyOnRails
[20:10:36] Aherin_: has joined #RubyOnRails
[20:18:42] kies: has joined #RubyOnRails
[20:20:10] duderono_: has joined #RubyOnRails
[20:26:08] drale2k_: has joined #RubyOnRails
[20:27:29] Technodrome: has joined #RubyOnRails
[20:34:10] theunraveler: has joined #RubyOnRails
[20:35:12] ejnahc: has joined #RubyOnRails
[20:37:22] lxsameer: has joined #RubyOnRails
[20:37:38] sagax: has joined #RubyOnRails
[20:49:00] blackmesa: has joined #RubyOnRails
[20:49:20] tercenya: has joined #RubyOnRails
[20:52:02] rikkipitt: has joined #RubyOnRails
[20:54:59] drale2k_: has joined #RubyOnRails
[20:56:22] ascarter: has joined #RubyOnRails
[21:16:17] sandstrom: has joined #RubyOnRails
[21:16:19] mustmodify: has joined #RubyOnRails
[21:17:42] mustmodify: My nginx + puma + rails 3.2 app just put up nginx's defensive "this site is busy" page after a deploy. It wasn't actually busy... but we seemed to have some runaway processes. Our 4-core VM had a load of over "7 5 3"
[21:18:03] mustmodify: The site is back up but the CPU usage is still crazy...
[21:18:04] mustmodify: https://gist.github.com/mustmodify/49cc6565c07fec5b16d22b506f57a9ea
[21:18:13] mustmodify: That's my `top`
[21:18:29] mustmodify: I'm trying to think how to even get started looking at this.
[21:22:37] drale2k_: has joined #RubyOnRails
[21:24:41] drale2k_: has joined #RubyOnRails
[21:28:57] Talltree: has joined #RubyOnRails
[21:33:11] ascarter: has joined #RubyOnRails
[21:33:13] xx00__: has joined #RubyOnRails
[21:35:12] cschneid_: has joined #RubyOnRails
[21:35:55] cschneid_: In the context of testing, Is there a way to ask for a view to be rendered, passing in a set of locals? I'm trying to do more "pure-function" style view partials, and it'd be nice to test them directly, rather than as part of the larger controller they may be part of
[21:36:11] cschneid_: (I also will have full-path controller rendering tests, just not as fiddly at assertions at that level)
[21:39:36] xx00__: has joined #RubyOnRails
[21:47:37] drale2k_: has joined #RubyOnRails
[21:50:14] HoierM: has joined #RubyOnRails
[21:56:07] kies: has joined #RubyOnRails
[22:00:41] jstrong: has joined #RubyOnRails
[22:01:20] jstrong: Hey! I need to build an authentication system that authenticates to a third party (Salesforce). We won’t store user contact information on our platform. It’s all passed and requested from Salesforcce.
[22:01:37] hahuang65: has joined #RubyOnRails
[22:01:38] jstrong: That said the authentication system needs to handle: secure password hashing, session management, remember me, sign in / sign out.
[22:02:26] jstrong: My thoughts were to use Devise and just strip out the database dependency layer, but that’s not as simple as I initially thought. The devise module that handles secure password hashing is DatabaseAuthenticatable which is completely tied to storing information into a local database.
[22:02:50] jstrong: Any ideas? Obviously “build from scratch” is a choice, but would prefer to use established libraries that will facilitate development and have taken into account standard security concerns.
[22:13:57] drale2k_: has joined #RubyOnRails
[22:14:17] psylone: has joined #RubyOnRails
[22:26:47] Radar: jstrong: good morning
[22:27:00] Radar: jstrong: did you consider https://github.com/realdoug/omniauth-salesforce ?
[22:27:29] jstrong: Radar: Unfortunately not an option because we’re rolling a custom auth that doesn’t use Salesforce users but instead uses Salesforce contacts (and for very good reasons)
[22:27:33] jstrong: so it’s all custom apis
[22:28:43] jstrong: Also o/ what’chu up to these days.
[22:29:06] hashrocket: has joined #RubyOnRails
[22:30:19] Radar: jstrong: ah ok then :)
[22:30:43] Radar: I'm currently working at Culture Amp as a senior backend engineer and we've just recently hired a junior dev who I'm mentoring in Ruby/Elixir.
[22:30:45] jstrong: Radar: thinking of creating a custom strategy that interacts directly with Warden and then just siphoning off functionality from DatabaseAuthenticable directly from the source.
[22:31:02] Radar: Yes that could work too.
[22:31:47] chare: has joined #RubyOnRails
[22:33:09] jstrong: Radar: Still enjoying rails?
[22:33:21] Radar: Yup, it's still good :)
[22:33:27] Radar: It pays the bills.
[22:34:58] Radar: I'm really enjoying Elixir + Phoenix though. The design of the language + framework makes more sense to me than Ruby.
[22:36:08] jstrong: I know a lot of rubyists who are full Elixir converts now :). My attention is being directed elsewhere (mostly python for machine learning) so unfortunately haven’t been able to delve into the language.
[22:36:39] chare: @Radar what do you think of volt
[22:36:45] Radar: chare: never heard of it
[22:36:55] chare: http://voltframework.com/
[22:37:18] chare: https://www.youtube.com/watch?v=7i6AL7Walc4
[22:38:05] chare: youtube video from RubyConf 2014 - Isomorphic App Development with Ruby and Volt by Ryan Stout
[22:38:11] Radar: A video? ain't nobody got time
[22:38:28] chare: @Radar watch it while having sex
[22:38:46] Radar: Radar kicked chare:
[22:38:46] mlt-: has joined #RubyOnRails
[22:38:50] clouder`grr: has joined #RubyOnRails
[22:39:27] jstrong: language converters always make me queasy
[22:39:34] jstrong: personal experience is short term wins long term headaches
[22:39:47] knight33: has joined #RubyOnRails
[22:40:14] tanuki: has joined #RubyOnRails
[22:40:21] chare: has joined #RubyOnRails
[22:42:11] Radar: jstrong: is that what Volt does?
[22:42:29] Radar: I haven't looked too closely tbh
[22:42:51] jstrong: yeah runs on Opal which is a Ruby to Javascript compiler
[22:43:38] jstrong: square peg in round hole imo
[22:45:27] patarr: has joined #RubyOnRails
[22:47:49] Radar: I'd prefer keeping the server + frontend logic separate. Seems like Volt ties the two too closely together for my liking.
[22:48:00] Radar: i.e. something like Rails with a React/Elm frontend would be more suitable.
[22:48:25] jstrong: well it’s just like, community support really does matter
[22:48:36] jstrong: and there’s an entire world of javascript frontend support
[22:49:34] psylone_: has joined #RubyOnRails
[22:53:48] drale2k_: has joined #RubyOnRails
[22:54:50] nesoi: has joined #RubyOnRails
[22:54:53] patarr: has joined #RubyOnRails
[22:58:26] chare: seems to me like Volt aims to be a single page application framework, that niche doesn't seem to have a winner yet
[23:04:31] drale2k_: has joined #RubyOnRails
[23:07:47] ephemer0l: has joined #RubyOnRails
[23:18:08] quazimodo: has joined #RubyOnRails
[23:25:00] ascarter: has joined #RubyOnRails
[23:27:11] psylone: has joined #RubyOnRails
[23:29:32] brent__: has joined #RubyOnRails
[23:31:15] drale2k_: has joined #RubyOnRails
[23:34:09] psylone_: has joined #RubyOnRails
[23:39:11] hobodave: has joined #RubyOnRails
[23:40:26] drale2k_: has joined #RubyOnRails
[23:50:23] knight33: has joined #RubyOnRails
[23:59:15] ascarter: has joined #RubyOnRails