Questions tagged as 'active-record'

1
answer

Join with Active Codeigniter Record

I made a query that is running ok and I'm passing to the Codeigniter Active Record but it is not working because of a join that is a bit off with conventional, does anyone have any idea what it can be? $query = $this->db->query("...
asked by 11.06.2014 / 15:42
1
answer

How to find out the number of records in a model?

I created a scaffold called a book and wanted to create a method for counting how many book entries exist in my database and use that result in the controller of another scaffold called a bulletin board where it will show the total number of boo...
asked by 03.06.2018 / 20:02
1
answer

Rails 4 Error each_with_index when using activerecord-import

I'm trying to import an app into Rails 4, using the gem activerecord-import . When I try to run the command: Detail.import( columns, values, :validate => false ,:timestamps => false ) I get an error like this: **NoMethodEr...
asked by 01.06.2016 / 18:10
1
answer

Query using "select" and "joins" with activerecord in Rails 4

I need to make a report and I have the following query : Deducao.joins(:prestador) .select('pessoas.razao_social, pessoas.qtd_min_mensal, count(deducoes.id)') .group('deducoes.prestador_id') .having('count(ded...
asked by 01.07.2015 / 20:52
1
answer

In the ActiveRecord is it mandatory to use belongs_to?

Is it mandatory that, for an association between two models, I have belongs_to and has_one ? Or is it possible to only use has_one/has_many between the two models, when not necessarily none of the models belong to any other?...
asked by 07.08.2017 / 04:43
1
answer

Add method in ActiveRecord :: Base

I created a method in ActiveRecord :: Base and it uses another method to be defined in the model, I need to validate if the model method is set before executing what I need, but it says is always undefined, what could it be? Ex: ActiveReco...
asked by 09.04.2015 / 16:16
2
answers

How to model with inheritance a structure of People?

Hello, I'm having trouble doing my Person modeling. Theoretically it seems a very simple thing, but I do not find a way that follows, say, "good programming practice". My problem is this: In my system I have a structure of several people, suc...
asked by 07.05.2015 / 15:25
1
answer

What is the difference between ActiveRecord and Repository?

I'm reading a POO book in PHP that calls PHP Object Oriented Programming [Pablo Dall'Oglio] and got a bit confused with these two design patterns , especially when it makes use of the Repository using ActiveRecord. It is worth noting that in th...
asked by 10.03.2017 / 04:00
1
answer

Java + Active Directory - Single Sign On

I was asked to do SSO for a web application in Java. The idea is that through computer information, the application checks in the AD and according to the user's OU it has access to certain application modules. I've already researched t...
asked by 25.01.2017 / 20:19
1
answer

How to modify this query to get the desired result in Codeigniter?

I have a SQL that returns me the following:    1: Hacker And Cars       OU       2: Food I need to get it back:    1: Hacker       E       2: Automotive OR Food The code I have so far is: if(!$final['termo'] == null)...
asked by 19.11.2016 / 15:58