Posts by Andre Leoni • 468 points
18 posts
-
0
votes3
answers169
viewsA: check if you have a comma and delete a comma if you have it in the string by Ruby
Hello, basically I would do like this def remove_last_character(text, character) string_to_array = text.split("") string_to_array.pop if string_to_array.last == character string_to_array.join("")…
rubyanswered Andre Leoni 468 -
1
votes1
answer138
viewsA: Operation of the helper collection_select
Hello, it basically works as follows, I took from the official documentation too https://apidock.com/rails/v4.0.2/ActionView/Helpers/FormOptionsHelper/collection_select collection_select(:post,…
-
0
votes1
answer49
viewsA: Rails 4 - Has_many problems
When Voce uses has_many, it will return an array of objects, that is, if Voce calls only the '.id', it will not allow it, because the '.id' is the attribute of an object, and it will not be able to…
-
0
votes2
answers57
viewsA: How to return data from the i18n translated api?
Using the ruby command eval you can create methods dynamically within the application... Create translations normally, and use this method within your class to return them... For example... name =…
ruby-on-railsanswered Andre Leoni 468 -
2
votes3
answers817
viewsA: How to simplify the translation call on i18n?
Just as Luiz commented, this naming rule is a Rails convention. There is a way, that would create a validate in the model by calling a function, and add a "custom" error to the error that happened.…
ruby-on-railsanswered Andre Leoni 468 -
4
votes3
answers93
viewsA: Q: Choose two select and display result
Here’s a hiccup that I think you can take care of, I did it with only two values, but then you can do it with the others, if you want to do all this dynamically, you can let them know that I’ll help…
-
0
votes1
answer113
viewsQ: Query with select and find in Rails
Hello, I wanted to make a find with select of only a few fields in Rails, but it is giving error, however, if I do with Where it works normally, does anyone know if it is possible to use select with…
-
0
votes1
answer26
viewsQ: Update_all Rails with own database field
I need to make a change to all the database columns by replicating the information from another column, for example: Model.update_all("a = b") I would like to create threads and start running, for…
-
0
votes5
answers666
viewsA: Upper DIV occupying entire screen
Hello, I believe that solves your problem: .tudo { width: 100%; height: 100%; } .superior{ background-color: blue; width: 100%; height: 80%; } .inferior{ background-color: red; width: 100%; height:…
-
4
votes1
answer174
viewsQ: Doubt about float field query (ruby on Rails with mysql)
Hello, I have a question regarding the database with Rails. If I declare a field to be "float", when I do the query, I need to use the ". to_float" so that Rails understands the type of this field?…
-
0
votes2
answers679
viewsA: Rename column with Rails using Migration
Man, when I need to rename I do it like this def self.up rename_column :users, :password, :password_digest end def self.down rename_column :users, :password_digest, :password end When he mistakes…
-
4
votes3
answers5691
viewsA: Can everyone see my projects on Github?
Hello, github projects as our friend explained above are only released public repositories for free accounts. If you are not interested in acquiring a private plan, I suggest exploring the tool…
githubanswered Andre Leoni 468 -
1
votes4
answers1978
viewsA: Mask in Rails fields
Opa, dude, from the look on MEIOMASK, I like it, and I think it respectively simple... I downloaded in this repository (https://github.com/johnvoloski/meiomask-rails), operation is more or less like…
-
1
votes1
answer329
viewsA: How could I add an ICONE inside a SELECT in HAML
I solved the problem as follows, First, I added the scape line Markup, $(document).ready(function() { $(".js-select-icons").select2({ minimumResultsForSearch: Infinity, escapeMarkup: function(m) {…
-
1
votes1
answer329
viewsQ: How could I add an ICONE inside a SELECT in HAML
Hello, I would like to add icons (from source, like bootstrap for example) inside a select field in HAML, at first I am doing so, would that be possible? I thought about using the bootstrap…
-
1
votes1
answer48
viewsA: I would like to create an object equal to a query in the database
Personal thanks for those who were willing to help, I arranged the problem in another way, I used an array and I took the answer by array, it worked out all right. def options_to_send_email…
-
1
votes1
answer48
viewsQ: I would like to create an object equal to a query in the database
I would like to create an object with the fields equal to the query of Activerecord, however, with the fields pre-filled or blank, so that they are called in the same way in the other file... To…
-
2
votes1
answer57
viewsQ: Difference between List and and Return in Entity
Hello, I am with a doubt when I will take the data of an SQL query, there is the possibility to pull by list and by Entity, which is would be the "most correct" or the usability of each? public…