Rafael Soares


4,080 Experience
39 Lessons Completed
0 Questions Solved


Posted in Huge syslog file in production

Hi Chris, thanks for the reply.

That's exactly it. I'm running Puma with systemd. I believe setting logrotate to something like 500M solves the issue for me, thank you very much.

One final question though: I already use lograge in my application, but as far as I know it logs to $APP_PATH/log/production.log
I've read the lograge documentation but couldn't find it: how do I suppress the sql statements being written to /var/log/syslog?

Posted in Huge syslog file in production


We have a rails app with sidekiq in an Ubuntu 18.04 machine hosted in AWS.

We've recently started to run out of space in our disk. I've then noticed that we have a huge /var/log/syslog file, that reaches more than 10gb every day. When I run "tail -f" on it, I basically see non-stop queries running from ActiveRecord calls.

Is this expected? Is it normal for the syslog file to get this big because of the queries being recorded?

I'm not sure if all rails apps are like this or if I have to change some configuration option.


Posted in Create form object with has_many attribute

Hi guys, the problem is that both of these libraries need ActiveRecord to work with, and I'm using only ActiveModel

class Lesson
   include ActiveModel::Model
   attr_accessor :students


class Student
  attr_accessor :name

I have to make a nested form for this. The activemodel-associations gets close, but it still needs an ActiveRecord object in one end of the relation to work

Posted in Create form object with has_many attribute

Hi all,

I often use form objects in some places in my application. But what I need now is something a little more complex.

When I create them, it's always an ActiveModel object with simple string attributes. But what I need now is for this object to have nested objects in them.

Ex: I have a ClassroomForm object, which has simple attributes such as name and teacher_id. But this Classroom object can have many student object, which has fields such as name and status.

What is the best way to do it using ActiveModel? Is the solution to create two form objects, ClassroomForm and StudentsForm, and then in ClassroomForm declare a attr_accessor :students ? But then how can I add new students in the form (using nested attributes)?

I did some searching in google and surprisingly dind't find anything related to it

Posted in Upload in webview

Hi Chris, thanks for the reply,

It does have permission to the camera roll. Actually I just did a test with a very simple snippet of code. I've put the following in a html file in the public folder.

<html> <body> <input type="file" name="test" /> </body> </html>

But it still doens't open the dialog box. Do you have any experience with this?

Posted in Upload in webview

I have a Rails web application, and I hired someone to develop an android and iphone app for it, which is just a webview opening the website.

In the web app, the user can upload an avatar picture. But uploading is not working from the app, it just doesn't open the dialog box to choose the file.

Anybody had this issue before and knows if there is a way I can solve this issue from the rails side?

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.