Questions tagged as 'ruby-on-rails'

1
answer

Extract hash in Ruby on Rails

I have the following Hash my_hash = {city: {id:1, created_at: '', name: 'test_city'}, uf: {id:1, created_at: '', name: 'test_uf'}} I need to extract some data from it eg: my_hash.extract!({city: [:id, :name], uf: [:id, :name...
asked by 29.04.2015 / 14:02
1
answer

I want to select a specific value in the collection_select, how do I?

Good morning, I'm working with ruby on Rails and I'm having a little difficulty. I have a value in a @n variable, and I have a collection_select that fetches all values from a collection. what I want to do is select the value that is in the @n v...
asked by 07.04.2015 / 16:02
3
answers

Conditional Relationships

I need your help I have the following template: class User < Ac... enum user_type: [:normal, :admin] end I also have the "Department" template: class Department < A.... end What I need is to do the type relationship: U...
asked by 08.04.2015 / 12:11
1
answer

How to make a Seed.rb by looking for random SQLite data in Rails?

As I already have a register of Cities and states, you can see below, my question is as follows, how can I put inside the 10.times function in the lines of address_city and address_state a parameter to search for cities and random states? within...
asked by 08.06.2015 / 20:05
1
answer

couriers freight gem

Hello, I'm using this calculation in the controller but when I put <%= @pac %> or <%= @sedex %> in the view is not showing the value, is someone having the same problem? grateful def calculate_ship frete = Correios...
asked by 19.03.2015 / 20:36
1
answer

Duplicate an association in ruby on rails

I have a question. I'vesentthetableI'vealreadydone,butIhaveaproblem,inthecaseof"Isolate's name" "catx" I have two "gene's name" associado, "catxx" e o "catxxx" , but I'm putting both in the same line and I would like to duplicate the l...
asked by 16.04.2015 / 19:18
1
answer

Image SVG conversion in Ruby on Rails

I have an application in rails and there I generate SVG images to return to the user via email, but I want to return this in another format (png or jpg). Does anyone have any tips on how I can do this?     
asked by 17.04.2015 / 20:46
1
answer

How to allow only the administrator to register user with Devise

I wanted to know if there is how only the administrator register user, with Devise. I can not program this. And where is the controller with Devise's methods in the project?     
asked by 16.04.2015 / 14:00
1
answer

Bypass FTP blocking

Hello I need to import a .zip file from a Brazilian FTP server. It works perfectly on my development machine, both using Ruby's native Net / Ftp and using linux wget, the problem is that it does not work in my production environment on Heroku...
asked by 06.12.2014 / 20:40
1
answer

Search using Solr in rails

If I search for a piece of a word other than the first few characters of the word it does not find. Type if I search for "Car" it searches correctly, but now if I search for "los" or "arlos" it returns empty. I have in the Client table: id...
asked by 05.01.2015 / 13:21