#RubyOnRails - 08 January 2018
« Back 1 day Forward 1 day »
[00:28:27] amperry: hey folks, I'm having trouble in production getting my assets (images, css, js) to load, and every page hit generates around 263 error messages. Gist here: https://gist.github.com/amp108/018a375eaa3ba0869434bcb1c34e26d3 <--- but I don't know what files to add to it.
[00:33:11] amperry: Radar: deployment has been an endless slog of two steps forward, one step back :(
[01:17:45] amperry: anyone know how to find out where Rails decides to look for a particular asset? Not necessarily the directory, but the hashed name?
[01:27:32] amperry: fryguy: there's a zero-length manifest-<long_hash>.js file there, but that's all.
[01:30:11] amperry: part of the problem is, rails is looking for files that don't exist, even if you accounted for fingerprinting.
[05:12:37] ali_g: Hello all! Has anyone successfully enabled Edit/update functionality on a belongs_to model with a single _form partial? I have Project has_many :tasks and Task belongs_to :projects. I can create tasks but when clicking on edit, the new form is loaded. Here the gist: https://gist.github.com/ponentesincausa/02d4b5cba3a61c880d0d604056273529
[05:14:28] Radar: https://gist.github.com/ponentesincausa/02d4b5cba3a61c880d0d604056273529#file-projects_controller-rb-L26
[05:15:20] Radar: ali_g: https://gist.github.com/ponentesincausa/02d4b5cba3a61c880d0d604056273529#file-views-tasks-_form-html-erb-L2 this is doing @project.tasks.build, so you'll always get the new form
[05:16:23] Radar: That way then, it will use the passed-in task instead of always assuming you meant @project.tasks.build
[05:30:41] ali_g: brilliant. Didn't know you could use render like that. Looks much better but still throwing an error.:
[10:27:34] noocx: can you help me with this please? https://gist.github.com/noocx/3be4be613bc177631936a66acdcb745e
[10:48:26] noob_on_rails: dang :p , i have to kind of metaprogram various helpers and also various methods for each helper
[10:49:20] noob_on_rails: else ill have to write a 300 line switch -.- , what do you propose tbuehlmann ?
[10:54:09] za1b1tsu: Factory bot bypasses my validations, this works (it should not): FactoryBot.create(:subject, type: Question, name: 'Test', min: 1) and this does not Subject.create(type: Question, name: 'Test', min: 1)
[10:58:03] za1b1tsu: the model in question, the validation is that either both min and max are null, or neither
[12:07:19] za1b1tsu: I have a scope :averageable, -> where 'type!="Review" AND min IS NOT NULL AND max IS NOT NULL'
[12:07:59] za1b1tsu: it gives me this error ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column "Review" does not exist
[12:16:19] waseem_: za1b1tsu: Try using where.not(type: "Review").where("min IS NOT NULL AND max IS NOT NULL")
[13:59:00] dionysus69: in that case regular registration doesn't send out confirmation email, api registration does send one email
[13:59:26] dionysus69: if I put include DeviseTokenAuth::Concerns::User above that devise declaration, then regular sign up sends one email and api registration sends 2 emails
[14:58:31] crova: How is it going folks? I can't figure why I'm ending up with multiple records for the same date (I need one record only per day) https://gist.github.com/crova/92a55c23ae46b5bf0e5089d8d8e790c1 Anyone got any pointers?
[16:51:28] xco: hi. if i have a URL that looks like this “http://something:3000/uploads/image_request/image/1066/1066386/1066386245/Cat%2520name%2520with%2520spaces.jpg" is there a way in Rails to decode the file name so instale of “%2520” I actually have the spaces?
[16:55:30] tcopeland: >> URI.unescape(URI.unescape("http://something:3000/uploads/image_request/image/1066/1066386/1066386245/Cat%2520name%2520with%2520spaces.jpg"))
[16:55:30] tcopeland: => "http://something:3000/uploads/image_request/image/1066/1066386/1066386245/Cat name with spaces.jpg"
[18:18:22] tcopeland: I think even before that it was required already… just tried it in a new rails 4 app and didn’t have to require ut
[20:13:28] AlHafoudh: what is the best way to handle social login when using rails api-only mode? I have an mobile app on the frontend and I was thinking passing social credentials acquired by the mobile app to the api in a form that omniauth /auth/:provider/callback accepts
[20:26:33] borodin: kinda clueless on this - I setup a new dir in app/ called app/services where I have created various classes for connecting to other services outside of my app. In those classes in app/services, I can't seem to use logger - it says undefined local variable or method 'logger'
[20:27:07] borodin: so I created a generic_service.rb defining a GenericService class which contains logger = Rails.logger, but this didn't change the error.
[21:44:10] herbst: Not exactly a Rails question, and maybe someone has done something similar. I have a web applications and many (remote) servers that do things and feed of data from the web application. This can be easily be done by master->slave replication using postgres. However the slaves also need to report statistics back to the web application. And this is where i am stuck. Its a lot of data, and i feel i cant just remotely connect to my main db to write
[21:44:56] fryguy: herbst: not really a detailed enough problem definition, but message queues are probably the answer you are looking for
[21:48:49] hpfmn: I tried to enable the log to see if something fails but all action mailer says in the log is "Sent email "SUBJECT"" and then the list of addresses it was sent to
[21:49:01] herbst: To clearify it a bit: My "slaves" are email servers. And i need to count emails, as well as log some of them. Both should reflect more or less live in the web application.
[21:51:32] herbst: hpfmn, however this sounds like a issue with Redmine if its happened within the update, maybe you need to ask them directly
[21:56:37] fryguy: what steps have you done to conclude that it's definitely only redmine that is the cause of the issue
[22:01:23] hpfmn: fryguy: and I'm basically asking if you guys know how to turn on more verbosity in the log
[22:01:41] fryguy: i assume you've followed these steps: http://www.redmine.org/projects/redmine/wiki/EmailConfiguration ?
[22:04:10] fryguy: what does the configuration stanza for email_delivery show in your config/configuration.yml file
[22:10:19] fryguy: it could be still delivering mail, just not via a mechanism that you are expecting (local mail spool, for example), or using the deprecated email.yml file, or something else. redmine also doesn't have much for logging in the first place.
[22:12:20] hpfmn: I'm I set up the thing in the file and also tried to add a config to instances/default/config
[23:25:02] Intii: Hi everyone, I have a organization/logic question... I have a model called School and it needs to be accessed via /schools and /conferences/:id/schools. Is the best practice to have one controller and load the data based on params? (I found this https://everydayrails.com/2010/07/13/nested-routes-controllers.html but it is a bit outdated) If that is the best practice, how would I handle creating a school from /schools and /conferenc
[23:44:26] Intii: Cool! Thanks Radar! Also have another question that's similar.. It has to do with users. Users can belong to both a school and a conference and they need to be managed by their respective parent. Would I still follow the same approach? A user created on the conference resource should automatically be assigend to that conference. A user created on the school resource should be assigned to the school