Questions tagged as 'ruby-on-rails'

1
answer

What is the best method in Rails to create a self-referenced category?

I would like a tip to create a self-referenced category where it would be possible to add daughter categories of its own and so suspectly for the purpose of building a tree using the same object. Is there a gem or an easy and well-optimized w...
asked by 05.02.2014 / 14:22
1
answer

RAILS File Seed Wheel, but Does Not Save The Data in the Database

I am creating a seeds file to popular my database, this file is responsible for popular Grupos(model :grupo) that runs without problem and also popular TipoAtividade(model :tipo_atividade) , which belongs to the group. > WhenIru...
asked by 22.11.2018 / 10:30
1
answer

Querying records in the bank via date

I'm developing a Ruby sales management system with Rails, and the customer needs to query sales through dates on two calendars, which together make up the range of data he wants to get pulled from the database. The graphical and functional pa...
asked by 25.10.2018 / 19:25
1
answer

Ruby login method

I'm trying to login with Ruby, however it's displaying the error undefined local variable or method 'login' for #<Object:0x00000000059ccea8> (NameError) I've set up the class: class Login <SitePrism::Page element :username_...
asked by 15.11.2018 / 14:12
1
answer

How to do checkbox validation in Ruby on Rails?

I'm studying ruby on rails for a while, and one of the exercises I'm trying to do is a checkbox and a submit button on a haml page, the purpose is for the submit button to work only if the checkbox is checked, otherwise just give a generic messa...
asked by 06.10.2018 / 17:00
1
answer

Rails - Gem CanCanCan and Devise

I use gems 'devise' and 'cancancan' and also 'rails_admin' in my project. All of them for the administrative part of the site. It is working perfectly this part. But in my main page of the site (root) it should not need authentication to acce...
asked by 27.05.2018 / 18:44
1
answer

Make two queries in one table in MySql

I have a table in MySql database where I will make a query. This query needs to be done as follows: For those who have a plan on the site: Allow search by: name, category (different table), address, neighborhood (different table), keyword...
asked by 15.06.2018 / 02:43
2
answers

Hide record for user

By "deleting" a precise record it hides it from a table in the user's view, but it must remain in the database. I put a field called ' status ' in the table that manages just that. In the view I put a ' if ' that performs the filter...
asked by 27.03.2018 / 20:13
1
answer

Ruby rails beginner [closed]

How do I create a program where I use my name and outputs with a greeting?     
asked by 16.02.2018 / 14:31
1
answer

Calculate the elapsed time after creating a record

I would like to know how to calculate the time between creating a record (created_at) and the current time . My intention is to show this difference in seconds, minutes, hours, or days that this occurred. Is there a gem / method to accomplish...
asked by 13.12.2017 / 21:07