Top "Activerecord" questions

Active Record is a pattern that combines domain logic with storage abstraction in single object.

Rails 4 LIKE query - ActiveRecord adds quotes

I am trying to do a like query like so def self.search(search, page = 1 ) paginate :per_page => 5, :page =&…

sql ruby-on-rails ruby postgresql activerecord
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.*') ->…

mysql activerecord fluent laravel eloquent
Check if record exists from controller in Rails

In my app a User can create a Business. When they trigger the index action in my BusinessesController I want …

ruby-on-rails ruby-on-rails-3 activerecord exists
How to select where ID in Array Rails ActiveRecord without exception

When I have array of ids, like ids = [2,3,5] and I perform Comment.find(ids) everything works fine. But when there …

ruby-on-rails activerecord find
Case-insensitive search in Rails model

My product model contains some items Product.first => #<Product id: 10, name: "Blue jeans" > I'm now importing some …

ruby-on-rails activerecord case-insensitive
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). Through experimentation …

ruby-on-rails activerecord foreign-keys
Can you do greater than comparison on a date in a Rails 3 search?

I have this search in Rails 3: Note.where(:user_id => current_user.id, :notetype => p[:note_type], :date =&…

ruby-on-rails activerecord ruby-on-rails-3
Pass array to where in Codeigniter Active Record

I have a table in my database with adminId and clientId There might be 20 records with the adminId of the …

php codeigniter 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 …

php mysql codeigniter activerecord null
Rails 3 migrations: Adding reference column?

If I create a new rails 3 migration with (for example) rails g migration tester title:tester user:references , everything works …

ruby-on-rails activerecord migration