#RubyOnRails - 06 May 2018
« Back 1 day Forward 1 day »
[06:12:28] orbyt_: I'm getting a `NoMethodError: undefined method `array' for #<ActiveRecord::ConnectionAdapters` how can I generate a model of an array type?
[07:51:50] timdotrb: I’m getting a Mongo error that I’m not finding much about online. Mongo::Error::SocketError end of file reached. I’m getting this error when I attempt to query my Mongo DB
[07:57:24] timdotrb: The site has been working without a problem for quite some time. I’m not sure when this issue began
[16:24:38] dionysus69: is it in plans to generate frozen_string_literals in every file in new rails apps?
[18:12:07] orbyt_: I'm writing a db/seeds.rb script. Is it a good idea to drop/reset the database here whenever this script is invoked?
[21:18:11] orbyt_: Follow up: is ActionCable able to serve as a websocket client? That is, can I connect to an arbitrary `wss://` endpoint with it?
[21:24:30] timdotrb: orbyt_: I’ve used it to connect to an API server that I’ve created, which it did not connect to at localhost.
[21:25:50] timdotrb: orbyt_: I guess that wasn’t a very clear statement: in my experience, yes - you can connect to an arbitrary wss:// endpoint
[22:33:19] orbyt_: timdotrb Do you know of any docs on using ActionCable as a client? I haven't seen a single example connecting to a remote server.
[23:07:06] timdotrb: orbyt_: I was working on this about a year ago, so I don’t recall if I came across docs on it. However, I do remember that information was sparse, and making it do what I wanted to do was a struggle
[23:08:45] orbyt_: I would have thought "use ActionCable as a client to a remote server" would have been a common use case.
[23:16:40] orbyt_: I've seen a suggestion to run a seperate node.js which does the websocket stuff and then communicates with a redis instance that is connected to by both the node.js server and rails. Changes in redis would then be picked up by the rails app
[23:19:12] timdotrb: orbyt_, yea. It does seem like a common usecase, and I have heard similarly that it's easier to get something setup and running in node
[23:19:53] timdotrb: orbyt_, I've tried to cut out relevant code from my app (on the client side). This connects to my api server for sending and receiving messages
[23:21:51] timdotrb: orbyt_, It does not include the code on my API server that sends / receives messages
[23:22:19] timdotrb: orbyt_, https://gist.github.com/willc0de4food/909c0aea991174817e764972cd9c249d#file-app-views-conversation-index-html-erb-L7
[23:23:34] timdotrb: orbyt_, yes. That code is in a Rails app, and connects to another server running a Rails app
[23:24:20] orbyt_: timdotrb The code you linked is an .erb file, which as far as I know is served to the client. What i'm trying to do is connect my rails server directly to another server, no front end involved.
[23:26:38] orbyt_: timdotrb A third party server exposes a websocket connectiong via `ws://example.com`. When my Rails app starts, I want to connect to that websocket, using Ruby.
[23:28:26] timdotrb: orbyt_, like this? https://stackoverflow.com/questions/30374029/ruby-connect-to-remote-websocket#31419790
[23:29:48] timdotrb: orbyt_, ActionCable is used for creating websocket servers. It sound like you are looking for a websocket client
[23:30:47] orbyt_: I came across https://github.com/shokai/websocket-client-simple but it looked like just some small hack
[23:36:31] orbyt_: So if this websocket is something that should just be on and running continually where should it be placed?
[23:37:27] Radar: Ok, then make it a rake task that inherits from the environment rake task in your rails app