Questions tagged as 'ruby-on-rails'

1
answer

Adding Time converting to seconds in Ruby

I'm trying to find the average difference between the creation date and the last update of the records in a table as follows: tickets = Ticket.all.where('updated_at IS NOT NULL') t = tickets.sum(:updated_at, conditions: 'updated_at.to_time') -...
asked by 11.03.2015 / 15:24
2
answers

Rails and postgres group_by by date considering time zone

How do I group records by date where the field is of type datetime? But that's considering timezone. For example: When the user enters 12/10/2014 23:30:00, it is recorded in the bank 10/13/2014 01:30:00, because our time zone is -2: 00 now...
asked by 08.11.2014 / 13:31
1
answer

Error: incompatible character encodings: UTF-8 and ASCII-8BIT

Incompatible character encodings: UTF-8 and ASCII-8BIT . {"utf8"=>"✓", "authenticity_token"=>"3cl0R8ghLDvPMGkh0I+LCrzQjmyu1donLE9y58rIT1k=", "post"=>{"title"=>"Somos apaixonados por música!", "caption"=>"Estamos entrando n...
asked by 04.06.2014 / 15:58
2
answers

Rails performing request XHR when loading pages

I've noticed that in every page / route exchange, Rails * makes a new request Ajax to fetch this new data (HTML), and thus page exchange. I did a lot of research but the closest I got was to Embedded Ruby ( erb ). If this is really...
asked by 11.07.2016 / 19:51
1
answer

Adding values from a column of a Ruby related entity

I'm trying to build an application in Rails. In it I have a resource where the user registers products and sales. The relationship is too many, to pass an array of products to sales I did the following def sale_params params.require(:sale)...
asked by 01.08.2016 / 19:31
2
answers

How to disable a combobox through a jquery condition?

I'm working on a project in Rails, where in a view project I have several comboBox, where at first I would like only one to be enabled, and according to the selected value the others are released. I think it would be interesting to use JavaScr...
asked by 14.10.2015 / 00:42
4
answers

Select without the id field (RoR)

I'm having a very silly question, I'm doing a system with Ruby on Rails and I need to do a select where the id field does not come, the problem is that this field is always present, for example: Employee.select('nome, email').all The a...
asked by 19.11.2015 / 15:47
2
answers

Go get the various fields to the query

I have this query: @tudo = Isolated.joins("LEFT JOIN resists ON resists.isolated_id = isolateds.id").joins("LEFT JOIN genes ON genes.isolated_id = isolateds.id LEFT JOIN stats ON stats.gene_id = genes.id LEFT JOIN mutations ON mutations.id = s...
asked by 18.04.2015 / 01:10
2
answers

Encrypt Ruby on Rails source code?

I need to deploy a ready-made Ruby on Rails framework system in a client's enterprise, the problem is that this client can not access the source code. Is there any way to "encrypt" or "compile" my code to be unreadable to third parties?   ...
asked by 17.11.2014 / 12:34
2
answers

How to organize css and js?

I purchased a free template and I'm applying it to my main blog page. I have created an administrative for this blog and I have a question if my assets organization is correct. Here is the structure: app / assets / javascripts:   Home   admin...
asked by 23.02.2015 / 02:55