Questions tagged as 'ruby-on-rails'

0
answers

Subdomain accessing only specific resources with Rails

I'm using Rails 4.2.2 I have the following code in the config / routes.rb file: Rails.application.routes.draw do namespace :api, constraints: { subdomain: 'api' }, path: '/' do resources :users end root "pages#home"...
asked by 23.06.2015 / 16:16
1
answer

Summing a value in a field with rails

Hello! In my users table I have a downloads field. I would like that when the user enters the page I add +1 in that user field. What is the best way to do this? Do I really need to do 2 querys? get the current value and then add anothe...
asked by 19.08.2014 / 14:23
1
answer

NoMethodError in Home # index

Next, I received a challenge to create a login page, using devise and with the logged in user, so that he could create a to-do list. The login I could do and it works well, already creating the part of the posts is being the biggest problem....
asked by 01.08.2014 / 05:21
0
answers

How to create a Mock in Ruby On Rails (CarrierWave) to simulate sending image to an S3 (Cloudinary)

I've created a project creation system with an image. My images are sent to Cloudinary + CarrierWave. Before the Test did not break because I sent it to the server, however when I joined the Cloudinary the code broke. I think I know what i...
asked by 27.11.2014 / 12:04
2
answers

Pull in database from heroku to local

I need to synchronize my bank's data in production with what's in my location, is there any way I can pull the bank from heroku to mine in localhost without having to create a new bank locally? My application uses the Mercury editor, so the clie...
asked by 21.08.2014 / 21:42
1
answer

Queries with multiple joins in ruby on rails

I want to do in ruby on rails, this: SELECT * FROM isolateds INNER JOIN genes ON geness.isolated_id = isolateds.id INNER JOIN stats ON stats.gene_id = genes.id INNER JOIN mutations ON stats.mutation_id = mutations.id When I do:...
asked by 17.04.2015 / 23:52
1
answer

Button with a value - Ruby on Rails

I have 2 buttons and each one will have to send a value of the model and will also be submit button 1 and button 2 - depending on the button I click it will send the value to the field @ evaluation.type. Similar to a like and di...
asked by 08.05.2014 / 04:40
0
answers

caches_page in rails 3 does not work in production [closed]

In development, caches_page works normally, but in production, it creates the cache and rewrites the cache to each access. Anyone have any idea how this issue can be resolved? My config / production.rb file: AppRuby::Application.configure d...
asked by 03.06.2014 / 03:29
0
answers

How to configure the schema_search_path in the test environment?

When I run the rake spec --trace command I have the error a below. It seems to me that rake does not create the schema I want in the test environment because it does not identify my schema configuration in database.yml. I've been researching and...
asked by 24.11.2014 / 12:41
2
answers

Generate random numbers

I have the following problem: I need to generate a random number between 1 and 6 Assign a array of numbers if this new one is not contained in array If contained, regenerate. Do this process until the array of numbers has 6 numbers...
asked by 12.01.2016 / 12:14