tagged [activerecord]
How to select rows where column value IS NOT NULL using CodeIgniter's ActiveRecord?
How to select rows where column value IS NOT NULL using CodeIgniter's ActiveRecord? I'm using CodeIgniter's Active Record class to query the MySQL database. I need to select the rows in a table where ...
- Modified
- 12 May at 07:44
How to convert ActiveRecord results into an array of hashes
How to convert ActiveRecord results into an array of hashes I have an ActiveRecord result of a find operation: Now I want to convert this results into an array of hashes like this: ``` [0] -> { :task_...
- Modified
- 23 Mar at 13:46
Codeigniter's `where` and `or_where`
Codeigniter's `where` and `or_where` I'm trying to specify a query in my model ``` $this->db ->select('*') ->from('library') ->where('library.rating >=', $form['slider']) ->where('libr...
- Modified
- 11 May at 15:24
How to change default timezone for Active Record in Rails?
How to change default timezone for Active Record in Rails? In my `application.rb` I came across the following comment As you see from above, I've made `conf
- Modified
- 28 Aug at 06:7
How to select where ID in Array Rails ActiveRecord without exception
How to select where ID in Array Rails ActiveRecord without exception When I have array of ids, like and I perform everything works fine. But when there is id that doesn't exist, I get an exception. Th...
- Modified
- 17 Sep at 23:12
Ruby on Rails generates model field:type - what are the options for field:type?
Ruby on Rails generates model field:type - what are the options for field:type? I'm trying to generate a new model and forget the syntax for referencing another model's ID. I'd look it up myself, but ...
- Modified
- 28 Aug at 06:14
Rails: scaling with group calculations
Rails: scaling with group calculations Currently I am running something similar to this command: which seems to work great when I have a small number of records. However when I attempt to call this wi...
- Modified
- 12 Feb at 19:48
How do you manually execute SQL commands in Ruby On Rails using NuoDB
How do you manually execute SQL commands in Ruby On Rails using NuoDB I'm trying to manually execute SQL commands so I can access procedures in NuoDB. I'm using Ruby on Rails and I'm using the followi...
- Modified
- 15 May at 20:11
Rails named_scopes with joins
Rails named_scopes with joins I'm trying to create a named_scope that uses a join, but although the generated SQL looks right, the result are garbage. For example: ``` class Clip "INNER JOIN series ON...
- Modified
- 3 Oct at 10:20
Query error handling in CodeIgniter
Query error handling in CodeIgniter I am trying to execute a MySQL query using the CI active record library. If the query is malformed, then CI invokes an internal server error 500 and quits without p...
- Modified
- 13 Jan at 17:39
Rails3/ActiveRecord: Change existing query to group by months
Rails3/ActiveRecord: Change existing query to group by months model entry.rb ``` def self.calculate(year, month, id) where(':id = entries.user_id', { :id => id }). where('entries.date Dat...
- Modified
- 20 Apr at 14:7
Float vs Decimal in ActiveRecord
Float vs Decimal in ActiveRecord Sometimes, Activerecord data types confuse me. Err, often. One of my eternal questions is, for a given case, > Should I use `:decimal` or `:float`? I've often come acr...
- Modified
- 28 Aug at 06:15
How to select count with Laravel's fluent query builder?
How to select count with Laravel's fluent query builder? Here is my query using fluent query builder. ``` $query = DB::table('category_issue') ->select('issues.*') ->where('category_id', '=', ...
- Modified
- 20 Dec at 00:55
ActiveModel::ForbiddenAttributesError when creating new user
ActiveModel::ForbiddenAttributesError when creating new user I have this model in Ruby but it throws a `ActiveModel::ForbiddenAttributesError` ``` class User true, :uniqueness => true, :length => {:in...
- Modified
- 4 Mar at 16:46
Rails: How can I set default values in ActiveRecord?
Rails: How can I set default values in ActiveRecord? How can I set default value in ActiveRecord? I see a post from Pratik that describes an ugly, complicated chunk of code: [http://m.onkey.org/2007/7...
- Modified
- 23 Jun at 15:4
Ruby on Rails. How do I use the Active Record .build method in a :belongs to relationship?
Ruby on Rails. How do I use the Active Record .build method in a :belongs to relationship? I have been unable to find any documentation on the .build method in Rails (i am currently using 2.0.2). Thro...
- Modified
- 21 Nov at 20:55
Is Single-Table Inheritance the right solution for my Rails problem?
Is Single-Table Inheritance the right solution for my Rails problem? Greetings, all, I'm working on an application in Ruby on Rails where we need to keep track of a bunch of external services for each...
- Modified
- 23 Sep at 15:7
Suggestions on how to map from Domain (ORM) objects to Data Transfer Objects (DTO)
Suggestions on how to map from Domain (ORM) objects to Data Transfer Objects (DTO) The current system that I am working on makes use of Castle Activerecord to provide ORM (Object Relational Mapping) b...
- Modified
- 4 Sep at 07:4