Questions tagged as 'ruby'

1
answer

Your Ruby version is 2.0.0, but your Gemfile specified 2.2.2

I can not run bundle install in my project, when s Your Ruby version is 2.0.0, but your Gemfile specified 2.2.2 appears. But I've already done a rbenv local 2.2.2 and when I run the rbenv version it returns me 2...
asked by 14.01.2016 / 11:44
1
answer

How do I update a list after the action of a remote form with AJAX?

I'm having a problem I've never had in Java but I'm almost going crazy in Rails. I'm developing a project where there are users and groups. So I created a separate model for N:N relationship between users and groups. In the group show...
asked by 03.02.2014 / 19:44
3
answers

Problems with belongs_to when using Ajax in Rails 4

I have three models in my application, Order , Product and Items . Within Items I have the following code: class Item < ActiveRecord::Base belongs_to :product belongs_to :order end I have a form where I ad...
asked by 12.02.2014 / 00:52
1
answer

How to use the break statement inside two loops in Ruby?

When you execute the "break" command in "if" are you able to exit the internal and external loop? not just one? while (i < maior) do if tam1>tam2 for i2 in 0 .. tam2 do if(palavra1[i]==palavra2[i2]) iguais = pal...
asked by 16.08.2018 / 20:08
1
answer

Defining a tree structure in ruby on rails

I'm developing a system in ruby on rails, and I'm stuck on one issue. My question is this: I need to create a tree, and then create my 'no' object and I would like it to have a 'no' parent and a 'no' child list. I tried the following approach:...
asked by 15.06.2017 / 19:56
2
answers

Carrierwave - destroy object only after it has been deleted from my storage

Carrierwave only deletes the 'mounted' file after the object in the database has been removed: after_commit :remove_avatar! :on => :destroy link I'm implementing a BackgroundDestroyable concern and for this I have a worker deleting...
asked by 13.03.2014 / 22:24
1
answer

How to do multiple image uploads with Rails 3?

I created a scaffold with the name "property", I need to add images next to it preferably in a different model referencing (1 property can have many images), where the user can select more than an image. The idea would be to create a button...
asked by 21.02.2014 / 13:39
1
answer

Passing parameters to the as_json method

I'm trying to pass parameters to the as_json (overwriting method) method in my model. Because only with the date that comes from the user I can return my result. According to that past date I add a field to the return json. We can call "new_valu...
asked by 16.03.2014 / 07:02
1
answer

Test boot time in Ruby on Rails

In Ruby on Rails, using the Minitest library, the runtime of the tests is fast. But the boot time before each rake test (...) is very annoying. Is there any way to make it faster? Update I tried to install Spring here ( gem 'spri...
asked by 06.05.2014 / 15:47
1
answer

Problems running only one unit test on rails 4

When I run all tests or just tests of a file it is working normally, but when I try to run only a single test, it just does not spin. I have this test require 'test_helper' class UserTest < ActiveSupport::TestCase test "is ban" do...
asked by 11.06.2014 / 04:06