Questions tagged as 'ruby'

3
answers

How to change the value between two variables without using an auxiliary variable?

I learned to program in C, but recently I have studied RUBY. Ruby allows you to change the value between two variables easily and without using an auxiliary variable, like this: a, b = b, a Without using an auxiliary variable, ho...
asked by 20.05.2014 / 05:15
3
answers

Sending e-mail via a notification button

I would like to know if you have already done or have an example that can link to the following problem: I have a project that has the crud of books and a User controller with their respective views. I made the normal email module as the g...
asked by 05.11.2015 / 00:13
2
answers

How to draw print from a web page using backend rails?

Would it be possible to do this? For example: I point a page to my application , and it holds a image of the indicated page. A print.     
asked by 25.07.2014 / 13:46
2
answers

How to use blocks in Ruby

I'm having a hard time understanding blocks in Ruby. Could someone explain to me why we use it?     
asked by 10.04.2015 / 22:53
2
answers

What practical applicability of the word super in Ruby?

There are several explanations on the internet about it. But I still can not understand what the practical applicability of the word super in ruby is. Okay, I know it's for calling the same-named method in the superclass. Right. But why would...
asked by 17.12.2014 / 17:20
2
answers

How to create a test with RSpec to check the return of users?

This describe below is the default that Rspec creates. I have a hard time working with TDD ( Test Driven Development ) and it is complicated to understand the whole procedure. For example, I need to test that when accessing the index...
asked by 14.01.2014 / 14:31
1
answer

Doubt Rails Relationship

I'm learning Rails yet, and I'm doubtful if I'm doing it right. I have a Animal Table and a Reproduction table, each animal can have one or more reproductions and each two Animals (Father and Mother) each reproduction can generate one o...
asked by 03.07.2016 / 20:30
2
answers

Ruby application that keeps reloading source files

How can I design my application so that whenever I modify and save a .rb file, the application behaves "in the new way"? I'm doing an application that reads the command, executes, prints the result and reads the next command (REPL, Read-Eval-...
asked by 17.01.2014 / 13:03
1
answer

What is the Java equivalent of this lambda in Ruby?

In your Inversion of Control text, Fowler uses as an example a Ruby code snippet that promotes that principle to invoke a bind method on the input field of text that passes an event name and a lambda as argument.Whenever the text input box det...
asked by 12.06.2018 / 02:52
1
answer

In Ruby on Rails is the business rule in the model?

In Java the business rule stays in the controller , but I heard a speaker saying that in Ruby on Rails the business rule stays in model . Does anyone confirm this?     
asked by 17.11.2016 / 09:05