Questions tagged as 'ruby'

1
answer

What is attr_accessor in Ruby?

I'm learning Ruby on Rails and in the content I'm studying I could not fully understand what attr_accessor is and how it works.     
asked by 13.05.2015 / 14:13
3
answers

Calculate parent and child totals

Friends I have 2 models. Orders have several details. I use cocoon to create the forms. The order model has a total that is the sum of the totals of the child models. What I would like to know is how best to implement a sum in the child and then...
asked by 23.02.2016 / 22:32
1
answer

Refresh DB table when clicking on a li element

I'm developing a mobile application using jqMobile and Ruby. How to update a database table by clicking on an item in a list. My list is generated like this: <ul data-role="listview" data-filter="true" data-filter-theme="a" data-divider-...
asked by 01.06.2014 / 17:42
2
answers

Heroku deploy with bower-rails

I have gem 'bower-rails' installed in my application but when deploy I have the following error: I added the gem rails_12factor I'm using buildpack : heroku buildpacks:set https://github.com/heroku/heroku-buildpack-ruby...
asked by 22.05.2015 / 16:44
1
answer

puts and p in Ruby

What is the difference between p and puts in Ruby? When should I choose to use one or the other?     
asked by 06.06.2017 / 20:22
3
answers

How to validate the CEI in ruby?

To validate CPF and CNPJ I use 'brcpfcnpj' in Gemfile. But I did not find anything to validate the CEI. How to validate the INSS Specific Registry in Ruby on Rails?     
asked by 29.05.2014 / 15:20
3
answers

How to declare a constant in Ruby?

How to declare a constant in Ruby? In other languages I do something like: const CONSTANTE = 1024 And CONSTANTE can not be changed at run time. But I do not think anything like it in Ruby.     
asked by 13.11.2017 / 15:21
2
answers

Quick search for a string or part of it in an Array

I have the following array : images = %W( droido 7midias vigilantes sebrae_mei dpe_saed websat ferpamweb dpe_chronus dpe_plantao promocast lolitaface dpe_intranet cha_bar clinica_sorriso droido_mascote bom_sabor ) What I want is a...
asked by 24.06.2016 / 20:21
1
answer

Are methods objects in Ruby?

Ruby has the class Proc , which is defined in the documentation as    blocks of code that have been bound to a set of local variables. Once   bound, the code may be called in different contexts and still access   those variables....
asked by 01.12.2017 / 13:53
3
answers

Installing ruby with rbenv

I have a question, I installed ruby in ubuntu, but it was installed without rbenv , have a problem install it now, or will it need to remove it first?     
asked by 07.10.2016 / 16:19