homeASCIIcasts

Episodes tagged with “active-record”

  1. 2

    Dynamic find_by Methods

    Shorten simple find and improve readability by using the dynamic find_by and find_all_by methods.

    Tags: active-record

  2. 3

    Find Through Association

    Use a has_many association in a find to avoid the need to pass foreign keys.

    Tags: active-record

  3. 14

    Performing Calculations On Models

    ActiveRecord provides class methods for performing calculations on models. See how in this episode.

    Tags: active-record

  4. 15

    Fun With Find Conditions

    You can pass objects other than strings to find conditions, but care must be taken to ensure that the correct SQL is generated.

    Tags: active-record

  5. 16

    Virtual Attributes

    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.

    Tags: active-record forms

  6. 22

    Eager Loading

    Improve the performance of your Rails application by reducing the number of database queries. Eager loading makes it easy.

    Tags: performance active-record

  7. 23

    Counter Cache Column

    Improve performance by caching the record count for a has_many association in a counter cache column.

    Tags: performance active-record

  8. 25

    SQL Injection Other translations: Id

    Attacks via SQL injection are one of the most common ways to attack web applications. Learn how to avoid being a victim of it.

    Tags: security active-record forms

  9. 26

    Hackers Love Mass Assignment

    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.

    Tags: security active-record forms

  10. 147

    Sortable Lists

    Find out how to create a drag and drop list using prototype and one of Rails’ helper methods.

    Tags: active-record plugins ajax routing

  11. 32

    Time in Text Field

    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.

    Tags: active-record forms

  12. 4

    Move Find Into Model

    Clean up your controllers and remove duplication by moving a find into your model. Use an association to call custom find methods.

    Tags: active-record

  13. 5

    Using with_scope

    Learn how to use with_scope - a very powerful method which will allow your custom find method to acceps any find options.

    Tags: active-record

  14. 152

    Rails 2.3 extras

    A round of some of the smaller new feaures in Rails 2.3 to finish the short series on Rails 2.3.

    Tags: rails-23 active-record active-support

  15. 154

    Polymorphic Association

    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.

    Tags: active-record routing

  16. 162

    Tree Based Navigation

    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.

    Tags: active-record plugins

  17. 163

    Self Referential Association

    In this episode we create a small social networking application and use a self-referential association to link users with their friends.

    Tags: active-record controllers

  18. 168

    Feed Parsing

    In this episode we use two different techniques to parse an RSS feed with Feedzirra.

    Tags: plugins active-record

  19. 176

    Searchlogic

    Searchlogic uses named scopes to make searching against models simple. See how to create simple and more complex searches in this episode.

    Tags: active-record plugins

  20. 33

    Making a Plugin

    Duplication can often be removed from your Ruby code by making methods dynamically. In this episode we make a plugin to do just that.

    Tags: active-record plugins

  21. 177

    Model Versioning

    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.

    Tags: active-record plugins

  22. 178

    Seven Security Tips

    Security is paramount in your Rails applications. Here we show seven commons security flaws from mass assignment to CSRF.

    Tags: security forms views active-record

  23. 179

    Seed Data

    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.

    Tags: active-record rails-23

  24. 135

    Making a Gem

    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.

    Tags: plugins active-record tools

  25. 181

    Include vs Joins

    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.

    Tags: active-record

  26. 189

    Embedded Association

    In this episode we show you how to embed a one-to-many or many-to-many association in a single integer field.

    Tags: active-record views

  27. 193

    Tableless Model Other translations: Es

    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.

    Tags: active-record

  28. 196

    Nested Model Form Part 1 Other translations: Es It Fr

    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.

    Tags: forms views active-record

  29. 202

    Active Record Queries in Rails 3 Other translations: Cn De Es

    Rails 3 introduces a new query interface for performing finds in Active Record. See how it works along with the changes in named scopes.

    Tags: rails-30 active-record