Posts by Adell • 133 points
15 posts
-
0
votes1
answer89
viewsQ: Active record, how to replace Uniq with distinct correctly?
I’m trying to recover the months where I have answers to a survey this way: Answers.pluck('EXTRACT(MONTH FROM created_at)').uniq (0.7ms) SELECT EXTRACT(MONTH FROM created_at) FROM `answers` =>…
-
0
votes1
answer30
viewsA: I am unable to update my table
Your mistake is logical, here: if($idSeg && $seg && $idTerca && $tercaa && $idQuarta && $quartaa && $idQuinta && $quintaa && $idSexta…
-
0
votes1
answer53
viewsQ: Employee research, multiformulary or single form?
I am developing an app that should be made available to employees of a particular company, so that co-workers themselves make the evaluation of one (two, three, etc.) working friends by answering…
-
1
votes3
answers12678
viewsA: How to create div with javascript
I made this jsfiddle using Jquery, since it did not say that it should be pure js, and it was like this Html: <div class="corpo"> <div class="esquerda">esquerda</div> <div…
-
1
votes2
answers3555
viewsA: Delete record by ID in PHP
Actually the error is logical. Your while will go through all received data, and will go through all of them, soon it will run delete on all as well and when you do the test…
-
-1
votes1
answer82
viewsA: Query with a specified date - PHP
//Query para os pedidos do dia $pedidos_do_dia = 'select * from pedidos where data_pedido = CURDATE();'; //Query para os pedidos de amanha // $amanha = date("Y")+"-"+date("d")+"-"+date("d")+"…
-
4
votes1
answer121
viewsA: recover mysql error message with php
Must be the concatenation! $conexao->query($query); $erro = "Errorcode: ".$conexao->errno; //Assim aparece o numero do erro da mensagem $erro = "Errorcode: ".$conexao->error; //Assim…
-
1
votes3
answers186
viewsA: How to pick up middle item with javascript or css?
If the div has only 3 items, it can be done like this: .item{ border: 1px solid green; } .item:nth-child(even) { border-color: orange; } <div class="corpo"> <div…
-
1
votes1
answer248
viewsA: Popular form already created with PHP(Mysql)
Patrick, I don’t think you understand what it’s like to change a form without reloading the page (I believe this is what you’re trying to do). The operation is more or less like this: The form…
-
1
votes1
answer41
viewsA: Set service price in select
Each html element can only send a single value to your target, to do what you want, there are a few ways: Use other inputs in the page (Hidden or even text) and these receive values by javascript…
-
0
votes1
answer130
viewsA: Rails and simple_form, filter values to fill a combobox
Answering my own question :-p = f.association :group, collection: Group.where('company_id = ?', current_user.company_id), selected: @subgroup.group_id…
-
0
votes1
answer130
viewsQ: Rails and simple_form, filter values to fill a combobox
There are three tables, one call enterprise, another group and a call subgroup, there is a field loan in this two, the last has the field group_id, a form, in this form use the simple_form to show a…
-
-2
votes3
answers601
viewsA: Mandatory fields depending on the form
I didn’t get to test it, but it doesn’t work that way? Set all fields as required In each controller action remove the methods you do not want def create if params[:user][:idade].blank?…
ruby-on-railsanswered Adell 133 -
0
votes0
answers43
viewsQ: Set a field in all models
I’m trying to create an app that works with several companies and I always need to record the field company_id whenever creating and/or updating any model, what’s the best way to do this? I thought…
-
1
votes1
answer84
viewsQ: Simple_form disabling selection item according to registration situation
I have a f.association that brings all registered customers. In the client I have a field status. I wish that when the status is false, client appears in select box, but is not selectable, this is…
ruby-on-railsasked Adell 133