#RubyOnRails - 20 July 2018
« Back 1 day Forward 1 day »
[03:29:55] fryguy: jerojasro: dotenv doesn't require files, it allows you to use files in conjunction with environment variables
[08:56:00] rikkipitt: hey folks, just after a bit of advice regarding a client/retainer wording. they sent through the following which doesn't doesn't make much sense to me, just wondering if anyone could improve on this with respect to Gems etc?
[09:04:55] apeiros: is there a way without modifying a rails project's Rakefile to have a gem's rake tasks loaded? Engines somehow manage to do that, but I don't want to turn a simple gem into an engine just for the tasks…
[09:10:21] mikecmpbll: apeiros : http://api.rubyonrails.org/classes/Rails/Railtie.html#class-Rails::Railtie-label-Loading+Rake+Tasks+and+Generators
[09:11:21] apeiros: mikecmpbll: how do I get rails to load that file upon calling `rake`? I tried mimicking a rails engine by having lib/my_gem/engine.rb, but that file wasn't even loaded
[09:12:44] conta: I remember hearing somewhere data database_cleaner is not needd anymore with latest rails
[09:13:02] mikecmpbll: afaik if your gem has a railtie with rake_tasks which is being loaded, then your application's Rakefile with `load_tasks` should handle loading those tasks
[09:13:54] apeiros: the problem is that `rake` doesn't even load a single file from my gem. not lib/my_gem.rb, not lib/my_gem/engine.rb and neither lib/tasks/my_gem.rake
[09:13:58] tbuehlmann: when having js-enabled capybara tests (or feature specs in rspec), you needed a database rewinder/cleaner in the past, since the server and your test didn't share the same database connection. that's fixed for system tests (and system specs in rspec) for newer rails versions
[09:14:16] apeiros: so even if I have a Railtie subclass, it's not loaded, so the callback isn't invoked either
[09:14:24] tbuehlmann: this officially only works for system tests, but will also work for everything else
[09:15:22] apeiros: so basically two lines: require expand_path(config/app) + Rails.app.load_tasks (code abbreviated)
[09:16:28] apeiros: the gem is available though, since if I add `load "tasks/gem_gem.rake"` to the rakefile, they load just fine.
[09:16:44] tbuehlmann: conta: so, "yes", you probably don't need a database rewinder/cleaner anymore
[09:17:49] conta: thanks! I'm also specifiyng ids in fixtures which does not seems to get cleaned, but I am reading now that I can use name of fixture when referencing so going to try that
[09:27:32] apeiros: ok, mystery thickens. I replaced the gem with a plain new gem generated through `rails plugin new my_gem` and added a rake task. and that task doesn't show up either. so I guess something is wrong with the host application? o0
[09:39:08] mikecmpbll: apeiros : either that, or my/our understanding :D i'd be looking at application.rb tho
[09:41:56] apeiros: something is off. it's certainly something stupid. I even built the gem and removed `path` in the gemfile and rebundled. no change either. and same thing in another app. I almost certainly do something wrong, I just can't figure what the heck that'd be :-S
[10:16:09] padung: Hi, I'm trying to use ar-octopus to do a replication for me. I have created 2 AWS RDS. One is master. another is replica.
[10:16:42] padung: I shut the master down to monitor replica could be used when it's the time. but it didn't work
[10:19:44] padung: seemed like it knew master cannot be connected but not trying to connect to the replica instead.
[10:56:46] padung: Or any other solution about how to configure rail to connecto another db if the old one's down.
[13:45:48] mikhael_k33hl: How do I generate a production database? whenever I run rake db:create, it only generate development and test databases
[14:02:19] mikhael_k33hl: nzst: thanks, I got that working now, have you encountered this issue though? Permission denied - bs_fetch:atomic_write_cache_file:open (Errno::EACCES) I'm running on ruby2.4/rails5.2
[14:04:34] nzst: i haven't seen it personally, but, you're not alone https://github.com/Shopify/bootsnap/issues/177 , looks like a bootsnap issue
[14:21:23] mikhael_k33hl: I have config.public_file_server.enabled = true but I still get the error The asset "application.css" is not present in the asset pipeline.
[14:27:29] mikhael_k33hl: App 4359 output: [c99ad2d2-1c94-4e4b-b623-d288989b255c] Completed 500 Internal Server Error in 26ms (ActiveRecord: 1.3ms) App 4359 output: [c99ad2d2-1c94-4e4b-b623-d288989b255c] App 4359 output: [c99ad2d2-1c94-4e4b-b623-d288989b255c] ActiveRecord::StatementInvalid (SQLite3::ReadOnlyException: attempt to write a readonly database: INSERT INTO "users" ("provider", "uid", "email", "token", "refresh_token", "created_at", "upd
[14:30:38] mikhael_k33hl: nzst: yeah, that'd be a good idea, new to rails and find it a bit complicated though
[15:59:00] chrisarcand: Hi! I'm looking to take an svg, base64 encoded in a data uri in a JSON request, and give that svg to ActiveStorage. I note I need to give a file object to AS's `attach`; is there a way to just provide a string (which I've cut out and decoded from the data uri?) Do I really need to write my own temp file just to hand it off?
[16:36:14] vrinek502: hello and apologies if this has already been reported but search on the API docs is missing results (eg try `after_create`)
[18:16:06] cagomez: does a hash need to have String keys for it to be serializable? serializable_hash
[18:16:17] cagomez: meant to post: http://api.rubyonrails.org/classes/ActiveModel/Serialization.html#method-i-serializable_hash
[22:45:20] Scriptonaut: hey all, I haven't written view tests in a long time (rspec). I just tried writing a few, and it causes an error because the instance vars are ending up nil. Those vars are set from an api request (from the server to a 3rd party). Does rails 5 or rspec disable remote requests like that?
[22:45:39] Scriptonaut: the page renders fine in the browser, complete with the data I fetch from that api call
[22:45:58] Scriptonaut: I don't have webmock or anything like that so I'm kind of puzzled why it's doing that