#RubyOnRails - 20 November 2018
« Back 1 day Forward 1 day »
[04:33:58] jstrong: Q: Can Rails engines’ autoload classes that are outside of the engine module namespace?
[08:58:14] _aeris_: `SOME_ARRAY_CONSTANT ||= JSON.parse(ENV["SOME_ARRAY_STRING"])` is better to preserve the else assignment
[11:33:32] adgtl: sylario for yesterdays' my question regarding error while running tests `ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_users_on_email"`
[14:38:09] tycoon177: does anyone here know how I could "group" 2 table rows in the Prawn pdf gem? Basically, if one of the rows is going to spill over to the next page, I need both of them to do so
[16:39:27] tweaks: i have an application (4.2.x) that forces ssl using the config.force_ssl = true environment setting. this uses a 307 status, i'd prefer a 301 - is there a way in production.rb to configure the status code?
[17:11:01] tubbo: tweaks: doesn't seem so. https://github.com/rails/rails/blob/fc5dd0b85189811062c85520fd70de8389b55aeb/actionpack/lib/action_dispatch/middleware/ssl.rb#L132-L138
[17:11:50] tubbo: seems like in the latest 4.2, that was https://github.com/rails/rails/blob/4-2-stable/actionpack/lib/action_dispatch/middleware/ssl.rb#L44
[17:15:51] tweaks: tubbo: hmm :/ you're right.. maybe this project has something else going on, time to dig. thanks
[17:23:01] ht85: I have a rails app in development behind an http proxy. The proxy serves the traffic using HTTPS, but requests it from rails using HTTP. Rails generates http:// urls for assets, and form actions. Is there a way to override this for the whole app, to force generating https:// urls? (rails 4)
[17:23:45] ht85: I've managed to override it for assets by using asset_host but no luck for form[action]
[17:25:23] tweaks: tubbo: this project has an application_controller.rb method force_ssl if: :ssl_configured? which just checks Rails.configuration.force_ssl -- seem redundant since production.rb has it enabled, perhaps this is the cause of the 307.
[17:29:06] tubbo: tweaks: ah ok. the controller macro `force_ssl` is different from `Rails.configuration.force_ssl`. https://api.rubyonrails.org/classes/ActionController/ForceSSL/ClassMethods.html#method-i-force_ssl (which just does a `redirect_to` in https://api.rubyonrails.org/classes/ActionController/ForceSSL.html#method-i-force_ssl_redirect)
[18:29:56] Travis-42: I'm playing around with a new rails 5.2 app and active job, and when I queue an activejob, it seems to work (I see the "Enqueued AJob to Async(default)" message). But it never seems to actually run. What may I have done wrong?
[20:11:12] tubbo: bambanx: B2B can mean "business-to-business" in the eCommerce world, these are stores that sell to other businesses rather than consumers. wholesalers, white label printing (like for t-shirts, stickers, etc), and office supply delivery are good examples of B2B sales.
[20:24:30] tycoon177: for anyone wondering the answer to my prawn question earlier, i ended up going through and making those rows a subtable. it's not pretty, but it keeps them together on the same page.
[22:23:46] FLeiXiuS: I have a model Lesson and a model Progress. Progress is a has_many :through for Users. I want to be able to eager load a Progress with a constraint. Ex: Lesson.order(:order).includes(:progress, where(user_id: 1))
[23:24:07] chris349: I try to make a new db migration, but I get some strange error about the code thats never popped up before. How can I just manually make the migration so I dont have to deal with this unrelated problem right now?