Questions tagged as 'ruby-on-rails'

1
answer

Active record, how to replace uniq with distinct correctly?

I'm trying to retrieve the months I have answers to a search this way: Answers.pluck('EXTRACT(MONTH FROM created_at)').uniq (0.7ms) SELECT EXTRACT(MONTH FROM created_at) FROM 'answers' => [3] This way I have the expected result, but I...
asked by 27.03.2017 / 16:34
2
answers

Color transition effect in navbar of a bootstrap template in Rails

Hello, I'm using a startbootstrap template, the Agency, I was able to import it into the Rails project, I put the theme in the vendor folder, I imported the scss in the application.scss and I put the requirements in aplication.js, agency.css, sty...
asked by 13.03.2017 / 06:23
0
answers

Set a field in all models

I'm trying to create an app that works with multiple companies and I always need to save the company_id field whenever I create and / or update any model , what is the best way to do this? to do this? I thought of a before_action around...
asked by 17.02.2017 / 18:45
1
answer

Counting records updated by day rails

How do I count updated records by date in rails? Next I have to receive this data in an array format to repass and convert to json. I have Table A that has many of Table B Through A I have to count how many records were updated per day in table...
asked by 08.02.2017 / 14:39
0
answers

Composite name in template does not generate plural in table name

I would like to ask a question by following up this post: How to program in Ruby in Portuguese on Rails? I started studying rails a short time ago and I'm going through a problem with pluralization. When I create the ProductClass template,...
asked by 15.02.2017 / 18:10
1
answer

How to get md5 from a record and check if it is unique?

I have an atypical need where several records are imported per lot, these records do not have unique identifiers, each record has information about a debt. I'm planning to create a md5 of each record so there is no duplicity. Of course I woul...
asked by 15.02.2017 / 19:23
0
answers

How do I solve issues related to loading modules / classes that are still in memory?

Around and half my Sidekiq gets the error shown below, and then is thrown again to the execution queue. After a while, the error automatically disappears and the queue continues to run normally. ArgumentError: A copy of StateMachines::Remittan...
asked by 15.02.2017 / 18:17
1
answer

Rails and simple_form, filter values to populate a combobox

There are three tables, one called company , another group and a subgroup call, / em> , a form, in this form I use simple_form to show a combobox with groups, but all come the groups and need to filter the groups of each company, how to do...
asked by 20.02.2017 / 13:52
1
answer

Problems running the rails server with vagrant

I created a Xenial Xerus 64x box with the vagrant, installed the rvm with rails. I'm running the server on the quiet VM, I can access the VM rails running there, but I can not access from my local browser. I had already used vagrant other...
asked by 19.01.2017 / 19:11
1
answer

How to return the entire object from an associative table?

The code below returns only the ID's of their respective relationships, I need instead of returning user_id and role_id to return the object user and role with the registry data. Take a look at my code: class Disput...
asked by 02.02.2017 / 13:54