Episodes tagged with “active-record”
MetaWhere & MetaSearch Other translations:
MetaWhere provides a way to do complex find conditions without SQL in Active Record. MetaSearch makes it easy to create search forms with many find options.
ActiveRecord::Relation Walkthrough Other translations:
The new Active Record query methods in Rails 3 might seem like magic at first. In this episode we unravel how it works by browsing the Rails 3 source code.
Multistep Forms Other translations:
In this episode we create a multistep form, or wizard, from scratch.
Advanced Queries in Rails 3 Other translations:
Learn some advanced techniques regarding named scopes and get an introduction to Arel in this episode.
Refactoring & Dynamic Delegator Other translations:
Learn how to refactor a set of conditional Active Record queries using a Dynamic Delegator.
Validations in Rails 3 Other translations:
Rails 3 offers several new additions to validations. Here learn how to make a custom error_messages partial, reflect on validations, and clean up complex validations in a model.
Active Record Queries in Rails 3 Other translations:
Rails 3 introduces a new query interface for performing finds in Active Record. See how it works along with the changes in named scopes.
Nested Model Form Part 1 Other translations:
The accepts_nested_attributes_for method, introduced in Rails 2.3, makes handling multiple models in a form much easier. Find out how to use it in this episode.
Tableless Model Other translations:
If you want to create a model without an associated database table all you need to do is define a couple methods in the model.
Embedded Association Other translations:
In this episode we show you how to embed a one-to-many or many-to-many association in a single integer field.
Include vs Joins Other translations:
The find method’s include and joins options can be a little confusing as they are so similar. Find out when to use which one in this episode.
Gems are now a more popular way of extending Rails than plugins. In this episode we go through the steps needed to create a basic gem.
Seed Data Other translations:
Rails 2.3.4 introduces a new convention for creating any seed data that your application needs. This means that you no longer have to put seed data in your migrations.
Seven Security Tips Other translations:
Security is paramount in your Rails applications. Here we show seven commons security flaws from mass assignment to CSRF.
Model Versioning Other translations:
If you need to keep track of the changes to an ActiveRecord model and switch between versions the Vestal Versions gem is well worth considering.
Making a Plugin Other translations:
Duplication can often be removed from your Ruby code by making methods dynamically. In this episode we make a plugin to do just that.
Searchlogic uses named scopes to make searching against models simple. See how to create simple and more complex searches in this episode.
Feed Parsing Other translations:
In this episode we use two different techniques to parse an RSS feed with Feedzirra.
Self Referential Association Other translations:
In this episode we create a small social networking application and use a self-referential association to link users with their friends.
The acts_as_tree plugin provides a good solution for handling a tree-based navigation. In this episode we build a navigation system with menus, subpages and a breadcrumb control.
Polymorphic Association Other translations:
Polymorphic associations can be a little tricky to understand. In this episode we'll show you how to create one and use it in controllers and views.
A round of some of the smaller new feaures in Rails 2.3 to finish the short series on Rails 2.3.
Time in Text Field Other translations:
Updating time fields via a series of dropdowns isn't the most elegant way to enter date and time information. Find out how to allow your users to enter dates and time in a text field instead.
Find out how to create a drag and drop list using prototype and one of Rails’ helper methods.
Hackers Love Mass Assignment Other translations:
If you're using mass assigment you're giving complete control to your models to your users. Learn how to protect them in this episode.
SQL Injection Other translations:
Attacks via SQL injection are one of the most common ways to attack web applications. Learn how to avoid being a victim of it.
Counter Cache Column Other translations:
Improve performance by caching the record count for a has_many association in a counter cache column.
Eager Loading Other translations:
Improve the performance of your Rails application by reducing the number of database queries. Eager loading makes it easy.
Virtual Attributes Other translations:
Keep your forms flexible by adding virtual attributes to your model. This powerful technique allows you to create form fields which may not directly relate to the database.
Fun With Find Conditions Other translations:
You can pass objects other than strings to find conditions, but care must be taken to ensure that the correct SQL is generated.
Performing Calculations On Models Other translations:
ActiveRecord provides class methods for performing calculations on models. See how in this episode.
Using with_scope Other translations:
Learn how to use with_scope - a very powerful method which will allow your custom find method to acceps any find options.
Move Find Into Model Other translations:
Clean up your controllers and remove duplication by moving a find into your model. Use an association to call custom find methods.
Find Through Association Other translations:
Use a has_many association in a find to avoid the need to pass foreign keys.
Dynamic find_by Methods Other translations:
Shorten simple find and improve readability by using the dynamic find_by and find_all_by methods.