« Back to channel list

#RubyOnRails - 14 August 2017

« Back 1 day Forward 1 day »
[00:00:36] jrabe: has joined #RubyOnRails
[00:11:41] jhfisc: has joined #RubyOnRails
[00:17:38] jhfisc: has joined #RubyOnRails
[00:38:19] Rodya_: has joined #RubyOnRails
[00:39:06] brent__: has joined #RubyOnRails
[00:39:08] gambl0re: has joined #RubyOnRails
[00:47:16] sevenseacat: has joined #RubyOnRails
[00:50:00] quirkycoders: has joined #RubyOnRails
[00:55:36] maryo: has joined #RubyOnRails
[01:10:10] brent__: has joined #RubyOnRails
[01:11:22] jhfisc: has joined #RubyOnRails
[01:13:28] nikivi: has joined #RubyOnRails
[01:17:21] jhfisc: has joined #RubyOnRails
[01:24:45] one_zero: has joined #RubyOnRails
[01:25:08] jmay: has joined #RubyOnRails
[01:30:15] alfiemax: has joined #RubyOnRails
[01:33:06] lessless: has joined #RubyOnRails
[01:33:15] elcontrastador: has joined #RubyOnRails
[01:47:38] irishfromua: has joined #RubyOnRails
[01:50:27] quazimodo: has joined #RubyOnRails
[01:50:52] jhfisc: has joined #RubyOnRails
[01:53:30] laphoraig007: has joined #RubyOnRails
[01:56:46] jhfisc: has joined #RubyOnRails
[02:00:48] maryo: has joined #RubyOnRails
[02:04:19] jhfisc: has joined #RubyOnRails
[02:06:44] maryo: has joined #RubyOnRails
[02:09:56] jphase: has joined #RubyOnRails
[02:10:44] jhfisc: has joined #RubyOnRails
[02:12:43] irishfromua: has joined #RubyOnRails
[02:17:35] jmay: has joined #RubyOnRails
[02:23:18] jhfisc: has joined #RubyOnRails
[02:35:04] jhfisc: has joined #RubyOnRails
[02:36:05] Haydos: has joined #RubyOnRails
[02:40:01] jhfisc: has joined #RubyOnRails
[02:43:27] quirkycoders: has joined #RubyOnRails
[02:52:55] jhfisc: has joined #RubyOnRails
[02:55:26] hfp_work: has joined #RubyOnRails
[02:55:56] jhfisc: has joined #RubyOnRails
[03:12:15] gusrub: has joined #RubyOnRails
[03:20:49] emers2n: has joined #RubyOnRails
[03:21:48] arBmind: has joined #RubyOnRails
[03:30:23] Rodya_: has joined #RubyOnRails
[03:33:44] brent__: has joined #RubyOnRails
[03:38:59] andrew9184: has joined #RubyOnRails
[03:40:30] beilabs: has joined #RubyOnRails
[03:43:16] jmay: has joined #RubyOnRails
[03:43:28] dblessing: has joined #RubyOnRails
[04:10:45] aajjbb: has joined #RubyOnRails
[04:15:16] xisall: has joined #RubyOnRails
[04:21:30] srinidhi: has joined #RubyOnRails
[04:24:37] quazimodo: has joined #RubyOnRails
[04:30:57] xisall: Hello partners, I was working in a application for hobby and actually I have a question, so this is my question. Would be good idea to create a navigation menu from a yaml configuration. So I have been searching an answer with advantages and disadvantages.
[04:44:02] xisall: has left #RubyOnRails: ()
[04:48:57] xisall: has joined #RubyOnRails
[04:52:39] fryguy: has joined #RubyOnRails
[05:08:04] xisall: has left #RubyOnRails: ()
[05:11:29] xisall: has joined #RubyOnRails
[05:12:41] chouhoulis: has joined #RubyOnRails
[05:15:44] xisall: has left #RubyOnRails: ()
[05:25:42] elcontrastador: has joined #RubyOnRails
[05:40:21] crst: has joined #RubyOnRails
[05:59:29] Tempesta: has joined #RubyOnRails
[06:03:15] Tempesta: has joined #RubyOnRails
[06:17:56] tetraktys: has joined #RubyOnRails
[06:21:55] srinidhi: has joined #RubyOnRails
[06:23:24] ur5us: has joined #RubyOnRails
[06:33:46] rakm: has joined #RubyOnRails
[06:38:48] armyriad: has joined #RubyOnRails
[06:51:29] jhfisc: has joined #RubyOnRails
[06:54:38] quazimodo: has joined #RubyOnRails
[06:59:16] conta: has joined #RubyOnRails
[07:08:09] dionysus69: has joined #RubyOnRails
[07:18:51] jhfisc: has joined #RubyOnRails
[07:24:52] jhfisc: has joined #RubyOnRails
[07:27:43] jhfisc: has joined #RubyOnRails
[07:28:25] high_fiver: has joined #RubyOnRails
[07:29:16] hackeron: has joined #RubyOnRails
[07:30:26] hackeron: Hey, I'm trying to run bundle exec rails assets:precompile in a Dockerfile, but it's dying with Errno::ECONNREFUSED: Can't connect to: redis://127.0.0.1:6379/0 -- that's correct, I do not have Redis installed yet.. How do I make it stop trying to connect to Redis?
[07:33:56] jhfisc: has joined #RubyOnRails
[07:37:51] matthewd: hackeron: Check the backtrace it's showing to see which line is making it connect to redis, and then make it not do that
[07:41:39] matthewd: hackeron: I'll admit I was going for an amusing phrasing, but it's also not quite as tautologically pointless as it may appear: there is something in your app causing that behaviour; it doesn't happen by default
[07:44:37] jhfisc: has joined #RubyOnRails
[07:49:45] Chernobuk: has joined #RubyOnRails
[07:53:42] emers2n: hackeron check config/cable.yml
[07:54:49] hackeron: emers2n: matthewd: it's an inializer wihch has Ohm.redis = Redic.new ENV.fetch('OHM_REDIS_URL', 'redis://127.0.0.1:6379/0') -- how do I not run this line of code when running rails assets:precompile?
[07:55:37] emers2n: If you don't need redis then why not comment that out
[07:56:33] hackeron: emers2n: I need it to run always except when running assets:precompile
[08:00:32] hackeron: because redis is used heavily by my app, but when I'm building my docker container, there is no redis service started yet - so I need to run assets:precompile without a running redis service
[08:00:37] matthewd: There's the perhaps-too-obvious option of just letting it try and fail, then rescuing the exception... though you'd need to consider the implications if you then tried to boot the actual app without redis available
[08:01:03] jhfisc: has joined #RubyOnRails
[08:01:57] hackeron: matthewd: I'm not trying to boot the app, I want to run assets:precompile to build a docker image, it does not require redis yet, so how do I tell my rails code oh, we're building assets? - skip this initializer. This used to be an option in rails3, but can't seem to find a solution in rails5
[08:02:01] emers2n: https://stackoverflow.com/questions/13096531/deploying-redis-on-heroku-when-manually-precompiling-assets
[08:02:30] hackeron: emers2n: yep, this is for rails3 and does not work in rails5 :(
[08:02:52] mikecmpbll: has joined #RubyOnRails
[08:06:22] matthewd: hackeron: Just set an ENV var?
[08:08:51] emers2n: This is probably retarded but would wrapping in a try allow you to slip through in assets:precompile?
[08:09:02] hackeron: matthewd: hmm, let me try that
[08:10:05] hackeron: emers2n: I want it to throw an exception if redis is not available in all other cases, I just want a way to detect if I'm running assets:precompile and skip this (and probably a whole bunch of other irelevant initializers)
[08:10:48] emers2n: Ah I see. Beyond my current understanding and skill level, but gl
[08:12:18] hackeron: trying with "ASSETS_PRECOMPILE=true bundle exec rails assets:precompile" and adding a condition in my initializers - hopefully that should work, but wonder if there is some cleaner way to detect assets:precompile
[08:14:45] hackeron: yes, that works, but messy
[08:14:54] matthewd: Not really; initialize_on_precompile went away specifically because it was problematic
[08:22:18] dazonic: has joined #RubyOnRails
[08:23:59] dazonic: Can someone please tell me why my strptime is failing with the %3N part?
[08:24:01] dazonic: Time.strptime "2017-08-10 05.28.13.479", "%Y-%m-%d %H\.%M\.%S\.%3N"
[08:26:17] emers2n: Cause it aint on the list prolly https://docs.python.org/2/library/time.html
[08:27:36] sevenseacat: dazonic: how is it failing?
[08:28:31] dazonic: ArgumentError: invalid strptime format - `%Y-%m-%d %H.%M.%S.%3N'
[08:28:43] dazonic: Ok I’ll read more on milliseconds
[08:28:52] emers2n: Use DateTime
[08:29:23] emers2n: Which shows %3N is valid: https://apidock.com/ruby/DateTime/strftime
[08:29:48] emers2n: Lol Oh my I linked Python earlier
[08:29:56] emers2n: Just disregard everything i said
[08:32:18] defsdoor: has joined #RubyOnRails
[08:33:08] high_fiver_: has joined #RubyOnRails
[08:35:49] emers2n: dazonic use %L instead of %3N
[08:39:27] dazonic: Thanks man. %3N to print,
[08:39:35] dazonic: %L to parse
[08:42:25] mikecmpbll: is it possible to permit a scalar and an individual value in the same param?
[08:42:52] mikecmpbll: e.g. foo: [:a, :b] and foo: :a are both valid? (strong params)
[08:43:55] emers2n: Yep cheers. You can print with %L too, but %N is the fractional digit seconds, so %3N is milliseconds or 3 digits, %6N microseconds or 6 digits, etc
[08:44:13] mikecmpbll: permit an array*
[08:45:57] gregf_: has joined #RubyOnRails
[08:48:25] mikecmpbll: ah. :foo, foo: []
[08:49:17] arBmind: has joined #RubyOnRails
[08:50:09] marr: has joined #RubyOnRails
[08:52:23] ur5us: has joined #RubyOnRails
[08:53:45] crst: has joined #RubyOnRails
[08:55:52] high_fiver: has joined #RubyOnRails
[08:56:37] crst: Hi, when I change a model (validates :balance, presence: true, numericality: true ...) do I need to do something specific that the change will be accepeted? I run rake:db and reloaded the server but it does not validate properly.
[09:24:31] crst: nevermind, it works. the problem is numericality: false, it still accepts letters
[09:27:54] Doldge: has joined #RubyOnRails
[09:57:23] my123: has joined #RubyOnRails
[10:04:05] workmad3: has joined #RubyOnRails
[10:20:50] mikecmpbll: has joined #RubyOnRails
[10:31:01] quazimodo: has joined #RubyOnRails
[10:43:14] apparition: has joined #RubyOnRails
[10:44:13] danman: has joined #RubyOnRails
[10:45:42] noob_on_rails: has joined #RubyOnRails
[10:46:38] noob_on_rails: hey guys! let's say i have a model , which has some serial_number field in the db. This serial number comes from an API. I want to call the api and each time check if there's a new one. Where should i call such a thing
[10:46:58] danman: has joined #RubyOnRails
[10:47:50] danman: has joined #RubyOnRails
[10:48:41] danman: has joined #RubyOnRails
[10:49:23] danman: has joined #RubyOnRails
[10:49:42] noob_on_rails: Generally where do we put these things on rails? , helpers / model / controller ?
[10:50:08] danman: has joined #RubyOnRails
[11:08:13] ur5us: has joined #RubyOnRails
[11:17:07] Ergo: has joined #RubyOnRails
[11:23:40] arBmind: has joined #RubyOnRails
[11:32:55] SteenJobs: has joined #RubyOnRails
[11:42:47] dviola: has joined #RubyOnRails
[11:52:02] laphoraig92: has joined #RubyOnRails
[12:01:27] beilabs: has joined #RubyOnRails
[12:38:13] s2013: has joined #RubyOnRails
[12:39:54] quirkycoders: has joined #RubyOnRails
[12:44:45] gregf_: has joined #RubyOnRails
[12:45:29] xall: has joined #RubyOnRails
[12:49:57] jhfisc: has joined #RubyOnRails
[12:58:04] digitalowl: has joined #RubyOnRails
[12:58:29] digitalowl: Hello, I have a question about cancan module, anyone use that?
[13:00:37] digitalowl: has joined #RubyOnRails
[13:04:22] tbuehlmann_: digitalowl: I'm rather a pundit guy, but let's give it a shot
[13:06:58] digitalowl: I have a simple rule, like 'can [:index, :view], Book, id: user.book_ids'
[13:07:38] digitalowl: But this rule return always true, when book_ids is enpty array, and when book_ids filled
[13:08:23] tbuehlmann_: before I go into detail: do you use cancan or cancancan?
[13:08:50] irishfromua: has joined #RubyOnRails
[13:12:13] xall: has joined #RubyOnRails
[13:15:25] tbuehlmann_: I suggest using cancancan instead, this may solve one problem or another
[13:16:30] ekinmur: has joined #RubyOnRails
[13:18:06] digitalowl: Maybe later, but I must use this library because I support old enterprise system
[13:19:56] tbuehlmann_: digitalowl: okay. what's the association between user and books? Book.belongs_to :user?
[13:20:33] digitalowl: > has_and_belongs_to_many :users
[13:22:26] tbuehlmann_: I think you have to use a block then: https://github.com/ryanb/cancan/wiki/Defining-Abilities-with-Blocks
[13:22:42] jhfisc: has joined #RubyOnRails
[13:24:01] digitalowl: hm.... Use 'unless user.book_ids.empty?' instead 'id: user.books_ids'?
[13:25:45] digitalowl: Oh, it's decision, thx.
[13:27:08] noob_on_rails: tbuehlmann_: hey! i have a question about active_model_serializers , any chance you've worked with that gem before ?
[13:27:27] dretnx: has joined #RubyOnRails
[13:27:47] tbuehlmann_: I did, but it's been years
[13:28:18] noob_on_rails: oh , can i explain the concept and you tell me if it's viable ?
[13:28:52] noob_on_rails: it's mostly about models and handling json responses rather than active_model_serializers gem
[13:35:40] noob_on_rails: ok , i have a Rais Api , which serves data to an Ember JS front using active model serializer. This creates a JSON formatted response.
[13:36:15] noob_on_rails: Now let's say i have a model named Car , which if i persist to the database , the active_model_serializer does a great job serving to Ember
[13:37:00] noob_on_rails: My problem is though , that Car model , should not be persistent in the DB , what i actually do is get the Car data from another API , and then using Hashie::Mash to consume
[13:37:27] noob_on_rails: is there a way , after i get the JSON response , to map all the attributes (from an index style response) to the Car model ?
[13:37:44] noob_on_rails: and make it work as a model but with no persistent attributes
[13:38:54] tbuehlmann_: in ember land?
[13:39:11] spheric: has joined #RubyOnRails
[13:40:22] noob_on_rails: rails only talking
[13:40:38] noob_on_rails: the actual question is
[13:40:59] noob_on_rails: how to map a JSON response(index) to a model with no persistent values
[13:41:15] noob_on_rails: and then use that models attributes or w/e to show stuff like index
[13:41:17] jhfisc: has joined #RubyOnRails
[13:41:25] noob_on_rails: so instead of doing @cars = Car.all
[13:41:48] noob_on_rails: you'd somehow do : @cars = (JSON response)
[13:42:33] noob_on_rails: i've done this before with elastic and by setting attributes to the model that correspond to the API response , but i sense that using elasticsearc/model and stuff like that gave me that ability
[13:43:30] tbuehlmann_: oh, the JSON response is the one from your third party api, right?
[13:44:34] noob_on_rails: i do serve another to Ember
[13:44:36] truenito: has joined #RubyOnRails
[13:44:56] noob_on_rails: if i manage to make my response fit to the model , as if it was taken from a Car.all query
[13:45:42] tbuehlmann_: pseudo: response['cars'].map { |car_attributes| Car.new(car_attributes) }
[13:46:40] noob_on_rails: response being a hash i suppose
[13:47:16] noob_on_rails: cars as a key , you map the value of cars , which expectedly is an array ,and each attribute to a new Car model
[13:47:19] noob_on_rails: without persisting ok
[13:47:27] jhfisc: has joined #RubyOnRails
[13:47:28] noob_on_rails: did i understand that well ?
[13:48:01] tbuehlmann_: I made some assumptions, but yeah, response['cars'] being an array of car attribute hashes, then just map them using Car.new
[13:48:40] noob_on_rails: ok , if this contained a lot of cars , as if it was an index response http://../cars
[13:48:51] noob_on_rails: and the mapping goes fine , where do i store them
[13:49:01] noob_on_rails: so i can show them in a view
[13:49:03] tbuehlmann_: I thought they are databaseless and you wouldn't store them?
[13:49:10] tbuehlmann_: oh, just `@cars = …`
[13:49:22] noob_on_rails: oh you didnt have an "=" my bad
[13:49:26] noob_on_rails: ok going to testit asap
[13:49:30] noob_on_rails: thanks tons man!! :D
[13:50:30] chouhoulis: has joined #RubyOnRails
[13:51:05] tycoon177: i'm guessing now, but is there any easy way to update between rails major versions easily? or is it going to be "update rails, squash conflicting gem versions, try again, repeat"?
[13:51:22] tycoon177: trying to get my company off of rails 3 finally
[13:51:38] tycoon177: since i don't think my boss is going to take the time
[13:54:31] knight33: has joined #RubyOnRails
[13:57:26] quirkycoders: has joined #RubyOnRails
[13:59:29] dretnx: has joined #RubyOnRails
[13:59:49] jhfisc: has joined #RubyOnRails
[13:59:59] quazimodo: has joined #RubyOnRails
[14:00:36] sevenseacat: follow upgrade guides
[14:03:33] xall: has joined #RubyOnRails
[14:05:09] jhfisc: has joined #RubyOnRails
[14:12:53] jhfisc: has joined #RubyOnRails
[14:12:53] aajjbb: has joined #RubyOnRails
[14:15:04] xcesariox: has joined #RubyOnRails
[14:15:11] Cesariox: has joined #RubyOnRails
[14:18:34] xisall: has joined #RubyOnRails
[14:20:07] xcesariox: has joined #RubyOnRails
[14:22:44] ResidentBiscuit: has joined #RubyOnRails
[14:23:43] jhfisc: has joined #RubyOnRails
[14:26:27] jhfisc: has joined #RubyOnRails
[14:32:52] jhfisc: has joined #RubyOnRails
[14:34:49] xisall: has left #RubyOnRails: ()
[14:39:44] kn-928: has joined #RubyOnRails
[14:41:48] jhfisc: has joined #RubyOnRails
[14:42:13] afromankenobi: has joined #RubyOnRails
[14:50:15] AzaToth: has joined #RubyOnRails
[14:51:56] jhfisc: has joined #RubyOnRails
[14:58:41] jhfisc: has joined #RubyOnRails
[14:59:00] jmay: has joined #RubyOnRails
[15:01:13] ams__: has joined #RubyOnRails
[15:02:51] dionysus69: has joined #RubyOnRails
[15:04:53] jhfisc: has joined #RubyOnRails
[15:08:47] jphase: has joined #RubyOnRails
[15:11:34] jhfisc: has joined #RubyOnRails
[15:13:00] beilabs: has joined #RubyOnRails
[15:14:37] Frem: has joined #RubyOnRails
[15:16:33] FastJack: has joined #RubyOnRails
[15:20:12] truenito: has joined #RubyOnRails
[15:22:54] jhfisc: has joined #RubyOnRails
[15:22:55] jphase: has joined #RubyOnRails
[15:23:14] kn-928: has joined #RubyOnRails
[15:29:22] jphase: has joined #RubyOnRails
[15:32:05] mustmodify: has joined #RubyOnRails
[15:34:23] mustmodify: My client has a Rails app. Users are either employees or my client's clients, all behind passwords. It's under control, as things go. I don't really differentiate between external-use API and used-by-our-website API. But now I realize I need to have contact information for when clients use the API so that I can (a) let them know if it's going to have additional fields or new endpoints and/or (b) contact them more quickly if they are causing an issue
[15:35:31] s2013: has joined #RubyOnRails
[15:35:34] jhfisc: has joined #RubyOnRails
[15:38:47] okdas: has joined #RubyOnRails
[15:40:54] mustmodify: I could create an "API contacts" table. :)
[15:41:33] jhfisc: has joined #RubyOnRails
[15:44:18] jhfisc: has joined #RubyOnRails
[15:49:24] okdas: has joined #RubyOnRails
[15:52:10] aajjbb: has joined #RubyOnRails
[15:53:47] npgm: has joined #RubyOnRails
[15:55:04] [Butch]: has joined #RubyOnRails
[15:58:09] jhfisc: has joined #RubyOnRails
[16:09:58] jhfisc: has joined #RubyOnRails
[16:11:18] emerson: has joined #RubyOnRails
[16:13:13] GodFather: has joined #RubyOnRails
[16:13:49] tetraktys: has joined #RubyOnRails
[16:15:54] jhfisc: has joined #RubyOnRails
[16:16:47] tetraktys: has joined #RubyOnRails
[16:20:16] et09: has joined #RubyOnRails
[16:20:50] et09: i want to jump in and out of a second database i have defined in my config/database.yml for only two controller actions, which don't rely on my models. is there a best practice?
[16:21:48] et09: i think ActiveRecord::Base.establish_connection will screw something up?
[16:24:24] jhfisc: has joined #RubyOnRails
[16:24:53] tbuehlmann_: et09: you can establish the connection in the models by calling `establish_connection(:some_name)` in them
[16:25:05] tbuehlmann_: some_name being the key used in the config/database.yml
[16:33:45] keegnotrub: has joined #RubyOnRails
[16:34:16] gusrub: has joined #RubyOnRails
[16:35:15] ovaltine: has joined #RubyOnRails
[16:35:37] et09: i see, so what i did was class SecondDb < ActiveRecord::Base // self.abstract_class = true // establish_connection(:second) // end, and then i'm using SecondDb.connection.execute(...). is that all correct?
[16:35:43] onkelhotte: has joined #RubyOnRails
[16:36:02] jhfisc: has joined #RubyOnRails
[16:40:14] jmay: has joined #RubyOnRails
[16:45:44] aajjbb: has joined #RubyOnRails
[16:45:55] tbuehlmann_: why the execute? you should be able to just use the models
[16:47:25] jhfisc: has joined #RubyOnRails
[16:55:14] chouhoulis: has joined #RubyOnRails
[16:55:16] conta: has joined #RubyOnRails
[16:56:03] jhfisc: has joined #RubyOnRails
[16:56:45] mustmodify: he siad "which doesn't rely on models."
[16:57:07] mustmodify: @et09 what information are you storing in the second DB?
[17:00:57] et09: too many different tables to create duplicate models for
[17:01:05] et09: it's a replica
[17:01:30] one_zero: has joined #RubyOnRails
[17:01:44] et09: as long as my solution doesn't accidentally use the main db or something, that should be fine
[17:02:30] matthewd: et09: Rails version?
[17:02:38] chouhoulis: has joined #RubyOnRails
[17:02:57] username1: has joined #RubyOnRails
[17:04:38] matthewd: class ApplicationRecord; def self.connection_specification_name; Thread.current[:use_replica] ? :replica : :primary; end; def self.with_replica; Thread.current[:use_replica] = true; yield; ensure; Thread.current[:use_replica] = false; end; end; MyModel.with_replica { MyModel.find(123) }
[17:05:03] username1: why does an AJAX request to a controller that uses redirect_to not redirect the page?
[17:05:23] username1: really have to use if request.xhr? and set window.location?
[17:06:31] username1: is it because rails thinks you should be using the HTML to do some client side rendering instead of doing an actual redirect if you are using AJAX?
[17:07:20] matthewd: et09: Of course you can just do the direct query thing.. just pointing out that there is in fact an ~easy way to use your existing models
[17:08:45] et09: oh, i see, nifty
[17:09:35] jmay: has joined #RubyOnRails
[17:10:25] et09: i didn't know you could set options on a thread like that
[17:11:02] jphase: has joined #RubyOnRails
[17:15:30] tetraktys: has joined #RubyOnRails
[17:16:11] jphase: has joined #RubyOnRails
[17:19:14] tetraktys: has joined #RubyOnRails
[17:20:23] s2013: has joined #RubyOnRails
[17:22:49] jhfisc: has joined #RubyOnRails
[17:28:49] jhfisc: has joined #RubyOnRails
[17:31:10] et09: matthewd: it seems to break on the :primary, i changed it to Rails.env.to_sym, but then it gives me "No connection pool with id development found", which uh...well, there's an entry in config/database.yml for development
[17:31:14] rakm: has joined #RubyOnRails
[17:32:30] matthewd: et09: How does it break with :primary?
[17:32:56] srinidhi: has joined #RubyOnRails
[17:33:09] et09: same, s/development/primary/
[17:35:26] et09: maybe i should call super?
[17:36:20] matthewd: Yeah, possibly. If nothing else, it should be able to confirm what the right default is :)
[17:36:41] et09: "primary" as a string
[17:37:00] jhfisc: has joined #RubyOnRails
[17:37:19] HelloCode: has joined #RubyOnRails
[17:37:21] matthewd: Ah, so they should both be strings I guess
[17:38:39] et09: yess beautiful +1
[17:40:52] mustmodify: has left #RubyOnRails: ()
[17:46:26] jhfisc: has joined #RubyOnRails
[17:49:30] et09: ah no. "replica" doesn't reference anything either.
[17:49:50] et09: matthewd. do i need to create a second connection specification or something?
[17:50:36] matthewd: Yeah, that one should be whatever name you're using in database.yml
[17:50:57] et09: doesn't appear to be. this is 5.0.2 btw, not 5.1 (my mistake)
[17:51:23] et09: "primary" isn't referenced in database.yml, only "development", "staging", etc.
[17:53:01] arBmind: has joined #RubyOnRails
[17:53:35] dionysus69: has joined #RubyOnRails
[17:54:05] tanuki: has joined #RubyOnRails
[17:54:14] matthewd: "primary" is special, and gets set to the entry matching Rails.env
[17:54:23] et09: well - ActiveRecord::ConnectionNotEstablished: No connection pool with id replica found.
[17:54:34] et09: and replica is def. in database.yml
[17:55:09] matthewd: Ah, I think there might be an extra step to define it
[17:55:26] rakm: has joined #RubyOnRails
[17:56:17] et09: should i just do ActiveRecord::Base.establish_connection(:replica) and then ensure ActiveRecord::Base.establish_connection(:primary) or similar?
[17:56:25] rakm_: has joined #RubyOnRails
[17:56:59] matthewd: I'd just copy the contents of establish_connection
[17:57:02] jhfisc: has joined #RubyOnRails
[17:57:14] matthewd: IIRC that did change between 5.0 and 5.1 so the one I'm looking at won't match what you need
[17:58:21] jphase_: has joined #RubyOnRails
[17:58:40] matthewd: Build the spec (https://github.com/rails/rails/blob/5-0-stable/activerecord/lib/active_record/connection_handling.rb#L51-L53), then call AR::Base.connection_handler.establish_connection
[17:59:13] matthewd: (and probably add a version check to remind that you'll need to change this when you upgrade to 5.1)
[18:00:28] et09: your solution worked with rails 5.1?
[18:01:29] matthewd: I think there's still a need to manually register the extra spec name
[18:01:32] matthewd: It just changes slightly to https://github.com/rails/rails/blob/5-1-stable/activerecord/lib/active_record/connection_handling.rb#L54-L58
[18:02:14] SteenJobs: has joined #RubyOnRails
[18:02:19] Or1on: has joined #RubyOnRails
[18:02:24] lacuna: has joined #RubyOnRails
[18:03:00] matthewd: These 3 lines are basically why there isn't just a guide I could point you to.. all the infrastructure is there, but the last 5% of the "UI" still needs to be finalized
[18:03:35] jhfisc: has joined #RubyOnRails
[18:04:14] duderonomy: has joined #RubyOnRails
[18:05:20] et09: what about 'configurations' in those lines?
[18:06:33] matthewd: Yeah, that's just a method on AR::Base
[18:08:31] jphase: has joined #RubyOnRails
[18:08:46] jhfisc: has joined #RubyOnRails
[18:12:18] et09: how can i check if it already exists
[18:12:40] et09: https://gist.github.com/djvs/88110384cce6ea2f008a7810fa20cfeb this is what i have
[18:12:57] matthewd: You should be able to just do it in an initializer, so no need to check
[18:13:10] matthewd: It doesn't actually connect at that point
[18:14:17] et09: it's still not working
[18:14:29] et09: ActiveRecord::ConnectionNotEstablished: No connection pool with id replica found.
[18:15:10] jhfisc: has joined #RubyOnRails
[18:15:13] et09: i put those two lines into an initializer
[18:18:29] et09: https://gist.github.com/djvs/88110384cce6ea2f008a7810fa20cfeb
[18:19:24] matthewd: Ah right, so you need to take the result of that spec call and pass it to AR::Base.connection_handler.establish_connection
[18:20:47] et09: how can i check within the block if i'm on the replica?
[18:20:56] et09: { } block, in my controller
[18:21:31] et09: ActiveRecord::Base.connection_pool.spec.name this gives me replica, but not sure if it's accurate
[18:21:38] et09: i mean, that gives me "primary"
[18:22:19] matthewd: To prove it's working? Check which server's logs it appears on maybe?
[18:22:26] et09: it's the same server on dev
[18:22:41] matthewd: Start by checking connection_specification_name is being called, I guess
[18:22:55] et09: "primary" lol
[18:24:43] et09: oh well if i puts from connection_specification_name, it shows 'replica' when i call something in the block
[18:24:48] et09: is that sufficient proof?
[18:25:17] matthewd: Sounds pretty good. Try breaking the config of the replica, and it should fail if it's trying to use it.
[18:25:29] et09: but then won't the app not start?
[18:25:55] matthewd: Doesn't connect until it first gets used
[18:27:27] et09: ok, looks good i think
[18:29:56] maryo: has joined #RubyOnRails
[18:31:14] conta: has joined #RubyOnRails
[18:37:20] gusrub: has joined #RubyOnRails
[18:38:20] emers2n: has joined #RubyOnRails
[18:38:23] defsdoor: hmm creating generators is a chore
[18:44:16] jhfisc: has joined #RubyOnRails
[18:50:23] arBmind: has joined #RubyOnRails
[18:59:29] et09: defsdoor: there's a generator for that
[19:05:46] srinidhi: has joined #RubyOnRails
[19:06:52] kapil___: has joined #RubyOnRails
[19:09:18] ur5us: has joined #RubyOnRails
[19:11:46] knight33: has joined #RubyOnRails
[19:16:28] jhfisc: has joined #RubyOnRails
[19:20:10] emers2n: I'm attempting to add click to load javascript pagination with the will_paginate plugin. I'm getting the javascript error GET http://localhost:3000/?page=2 500 (Internal Server Error), but when I visit the page myself it works fine. Any debug tips?
[19:20:49] jhfisc: has joined #RubyOnRails
[19:22:09] emers2n: Nvm, figured it out
[19:22:18] et09: emers2n: inspect the query and replay it in console. request 'accept' type is probably different for one
[19:24:01] gambl0re: has joined #RubyOnRails
[19:25:04] rakm: has joined #RubyOnRails
[19:26:44] jhfisc: has joined #RubyOnRails
[19:31:48] jhfisc: has joined #RubyOnRails
[19:35:09] Ergo: has joined #RubyOnRails
[19:35:47] jhfisc: has joined #RubyOnRails
[19:37:12] jmay: has joined #RubyOnRails
[19:41:00] s2013: has joined #RubyOnRails
[19:42:43] jphase: has joined #RubyOnRails
[19:43:33] dionysus69: has joined #RubyOnRails
[19:55:57] jphase: has joined #RubyOnRails
[19:56:08] jmay: has joined #RubyOnRails
[20:02:49] jhfisc: has joined #RubyOnRails
[20:06:41] jphase: has joined #RubyOnRails
[20:09:47] netzfisch: has joined #RubyOnRails
[20:20:19] username1: has joined #RubyOnRails
[20:26:44] jhfisc: has joined #RubyOnRails
[20:32:03] high_fiver: has joined #RubyOnRails
[20:37:04] jphase: has joined #RubyOnRails
[20:37:54] jphase: has joined #RubyOnRails
[20:37:56] gambl0re: has joined #RubyOnRails
[20:40:03] andywww: has joined #RubyOnRails
[20:48:09] arBmind: has joined #RubyOnRails
[20:50:16] emerson: has joined #RubyOnRails
[20:57:53] jphase: has joined #RubyOnRails
[20:59:19] ur5us: has joined #RubyOnRails
[21:00:09] jhfisc: has joined #RubyOnRails
[21:00:12] jphase: has joined #RubyOnRails
[21:04:45] andywww: has joined #RubyOnRails
[21:14:13] jhfisc: has joined #RubyOnRails
[21:22:30] emerson: has joined #RubyOnRails
[21:25:15] jhfisc: has joined #RubyOnRails
[21:28:10] S007: has joined #RubyOnRails
[21:30:25] hahuang65: has joined #RubyOnRails
[21:30:49] S007: has joined #RubyOnRails
[21:31:09] jhfisc: has joined #RubyOnRails
[21:36:10] jhfisc: has joined #RubyOnRails
[21:41:07] chouhoulis: has joined #RubyOnRails
[21:41:53] gusrub: has joined #RubyOnRails
[21:46:25] jhfisc: has joined #RubyOnRails
[21:48:10] hahuang65: has joined #RubyOnRails
[21:48:14] brent__: has joined #RubyOnRails
[21:49:56] srinidhi: has joined #RubyOnRails
[21:50:16] jhfisc: has joined #RubyOnRails
[21:54:23] Fridtjof: has joined #RubyOnRails
[22:00:44] jhfisc: has joined #RubyOnRails
[22:01:27] beilabs: has joined #RubyOnRails
[22:02:36] cagomez: has joined #RubyOnRails
[22:02:38] et09: has joined #RubyOnRails
[22:13:51] jhfisc: has joined #RubyOnRails
[22:18:19] jhfisc: has joined #RubyOnRails
[22:18:33] jaegerca: has joined #RubyOnRails
[22:18:56] jaegerca: Anyone know any good gems to allow users to tag other users, or other things in the application?
[22:20:39] havenwood: jaegerca: https://github.com/mbleigh/acts-as-taggable-on#actsastaggableon
[22:21:17] jaegerca: havenwood: I looked at that, but unless I am missing something, a user can't tag another user with that and have a private list of tags for someone else.
[22:22:14] jaegerca: It seems like users just have tags, not tags in respect to other users.
[22:22:55] rakm: has joined #RubyOnRails
[22:23:04] et09: has joined #RubyOnRails
[22:23:27] jmay: has joined #RubyOnRails
[22:28:31] jhfisc: has joined #RubyOnRails
[22:28:48] jaegerca: havenwood: Am I missing something?
[22:29:10] havenwood: jaegerca: Give me a minute and I'll take a look.
[22:33:46] jhfisc: has joined #RubyOnRails
[22:40:25] emers2n: has joined #RubyOnRails
[22:41:44] jhfisc: has joined #RubyOnRails
[22:46:07] cagomez: has joined #RubyOnRails
[22:48:11] mikecmpbll: has joined #RubyOnRails
[22:50:05] rakm: has joined #RubyOnRails
[22:52:34] jhfisc: has joined #RubyOnRails
[22:55:02] irishfromua: has joined #RubyOnRails
[22:57:42] jmay: has joined #RubyOnRails
[22:58:41] jhfisc: has joined #RubyOnRails
[22:59:32] hahuang65: has joined #RubyOnRails
[23:07:09] gusrub: has joined #RubyOnRails
[23:10:11] hahuang65: has joined #RubyOnRails
[23:11:15] jhfisc: has joined #RubyOnRails
[23:11:28] jaegerca: havenwood: I guess I could somewhat see it working by adding it to the join model connecting one user to another.
[23:17:07] FastJack: has joined #RubyOnRails
[23:17:37] jhfisc: has joined #RubyOnRails
[23:23:07] jhfisc: has joined #RubyOnRails
[23:26:36] rakm: has joined #RubyOnRails
[23:26:54] SteenJobs: has joined #RubyOnRails
[23:28:26] arthurnn: has joined #RubyOnRails
[23:28:58] jhfisc: has joined #RubyOnRails
[23:55:18] xcesariox: has joined #RubyOnRails
[23:55:18] aclark: has joined #RubyOnRails
[23:55:18] segy: has joined #RubyOnRails
[23:55:18] scrooloose: has joined #RubyOnRails
[23:55:18] urkle: has joined #RubyOnRails
[23:55:18] biox: has joined #RubyOnRails
[23:55:18] apeiros: has joined #RubyOnRails
[23:55:18] Voxxit: has joined #RubyOnRails
[23:55:18] havenwood: has joined #RubyOnRails
[23:55:18] guacamol1: has joined #RubyOnRails
[23:55:18] uxp: has joined #RubyOnRails
[23:55:18] ErhardtMundt: has joined #RubyOnRails
[23:55:18] fumk: has joined #RubyOnRails
[23:56:20] FastJack: has joined #RubyOnRails
[23:56:20] Cork: has joined #RubyOnRails
[23:56:20] mr-spoon: has joined #RubyOnRails
[23:56:20] tomaw: has joined #RubyOnRails
[23:56:20] drcapulet: has joined #RubyOnRails
[23:56:31] Or1on: has joined #RubyOnRails
[23:56:31] one_zero: has joined #RubyOnRails
[23:56:31] fryguy: has joined #RubyOnRails
[23:56:31] laphoraig75: has joined #RubyOnRails
[23:56:32] sonOfRa: has joined #RubyOnRails
[23:56:32] codelahoma: has joined #RubyOnRails
[23:56:32] planigan: has joined #RubyOnRails
[23:56:32] dnyy: has joined #RubyOnRails
[23:56:32] [dmp]: has joined #RubyOnRails
[23:56:32] adgtl: has joined #RubyOnRails
[23:56:32] JDeen: has joined #RubyOnRails
[23:56:32] newton: has joined #RubyOnRails
[23:56:32] TheMonster_: has joined #RubyOnRails
[23:56:32] TessaM: has joined #RubyOnRails
[23:56:32] wsmoak: has joined #RubyOnRails
[23:56:32] jxf: has joined #RubyOnRails
[23:56:32] soahccc: has joined #RubyOnRails
[23:56:32] podman: has joined #RubyOnRails
[23:56:32] Kilo`byte: has joined #RubyOnRails
[23:56:44] irishfromua: has joined #RubyOnRails
[23:56:44] hackeron: has joined #RubyOnRails
[23:56:44] hive-mind: has joined #RubyOnRails
[23:56:44] loglaunch: has joined #RubyOnRails
[23:56:44] kitallis: has joined #RubyOnRails
[23:56:44] ule: has joined #RubyOnRails
[23:56:44] ArTiSTiX: has joined #RubyOnRails
[23:56:44] shamanime: has joined #RubyOnRails
[23:56:44] xhoy: has joined #RubyOnRails
[23:56:44] TinkerTyper: has joined #RubyOnRails
[23:56:44] baweaver: has joined #RubyOnRails
[23:56:44] shtirlic: has joined #RubyOnRails
[23:56:44] xMopxShell: has joined #RubyOnRails
[23:56:44] ankhers: has joined #RubyOnRails
[23:56:44] elomatreb: has joined #RubyOnRails
[23:56:44] daemonwrangler: has joined #RubyOnRails
[23:59:45] aclark: has joined #RubyOnRails
[23:59:45] segy: has joined #RubyOnRails
[23:59:45] scrooloose: has joined #RubyOnRails
[23:59:45] urkle: has joined #RubyOnRails
[23:59:45] biox: has joined #RubyOnRails
[23:59:45] apeiros: has joined #RubyOnRails
[23:59:45] Voxxit: has joined #RubyOnRails
[23:59:45] havenwood: has joined #RubyOnRails
[23:59:45] guacamol1: has joined #RubyOnRails
[23:59:45] uxp: has joined #RubyOnRails
[23:59:45] ErhardtMundt: has joined #RubyOnRails
[23:59:45] fumk: has joined #RubyOnRails