Questions tagged as 'ruby'

1
answer

How to redirect to application folder?

I use ROR with Nginx . How can I do what nginx redirects to the application folder? Instead of the /public folder.     
asked by 04.04.2014 / 16:29
1
answer

How to add values from a column in Ruby / RoR

Beauty? I'm trying to build an application in Rails. I have a feature where users report the runtime related to a category . Well, I need to add up the total time in the runtime column to be able to show to a particular user: "You've al...
asked by 08.04.2014 / 01:06
1
answer

Active admin and Devise in the application

In this app I'm working I use active admin and in the application I use Devise. Both use it for login. When I logged out from / admin I'm redirected to the end user's main screen which starts with a login screen. The issue is that when try...
asked by 15.03.2014 / 07:20
1
answer

Ruby on rails read csv file and fill table

I have the following news table: create_table "noticia", force: true do |t| t.integer "conteudo_id" t.integer "entidade_id" t.integer "imagem_id" t.string "texto" t.datetime "created_at" t.datetime "updated_at" e...
asked by 24.06.2014 / 15:05
1
answer

Algorithm takes 5sec but the page takes 1.5m to load

After calling a process via ajax if ($('#content-recommendation').length) { $.ajax({ url:'/get_content_recommendation/' + gon.item_id + '.js', type:"get" }); } I do the following in itens_controller/get_content_recommendati...
asked by 23.08.2014 / 16:36
1
answer

Accessing Rails Link Table Fields

MODIFIED QUESTION: I have an application that has 2 tables: Curso and Cargo and a third table curso_cargo that makes the HBTM between them. I would like to know how to access a field of this curso_cargo ta...
asked by 20.06.2014 / 15:10
1
answer

How do I create routes that accept only the allowed values?

How do I: accept status only allowed values? # routes.rb get '/para_:status(/:opcao1)(/:opcao2)', to: 'search#index', :as => :search Currently: status accepts anything I send. I want the: status to only be: enabled or disabled. Can...
asked by 27.02.2014 / 00:05
1
answer

How to calculate the difference between two distinct hours in milliseconds?

What is the way to calculate in milliseconds the time of an action in ruby? I'm doing the following: start_time = Time.now Execute given code that takes a few milliseconds end_time = (Time.now - start_time) And as a resu...
asked by 18.02.2014 / 21:38
1
answer

Does using engines in Rails 4 work in the same way as in Rails 3.x?

Through a number of searches over the last few days regarding application modularisation with Rails, I found extensive material on Engines in Rails 3.x, but practically nothing about Rails 4. I asked for references to a friend and he told me in...
asked by 20.02.2014 / 12:25
1
answer

Ruby on Rails: Rake aborted!

I'm starting in the Rails world through the Ruby on Rails book - Put your web application on the rails. After creating a "users" module the guide tells us to add the following command line in the migration: add_index :users, :email, :uniqu...
asked by 18.02.2014 / 21:07