Projects (0)

    Ruby on Rails

    Joe Dollard Jul 30, 2008

    Tags (23)

      Users (1)

        Cytes in the Ruby on Rails project

        help

        Showing all 20 Cytes

        Sort by Date

        Sort by Date

          • View Cyte

            Migrations

            active record migrations
            Cyted by
            Joe Dollard on Sep 24, 2009

            was required in a migration I wrote

            You can force Active Record to re-read the column information with the reset_column_information method, for example

          • View Cyte

            Stop updated_at from auto updating? - Ruby Forum

            updated_at
            Cyted by
            Joe Dollard on Jun 18, 2009

            You can disable this behaviour by setting AR::B class variable record_timestamps to false. in config/environment.rb, Rails::Initializer.run block : config.active_record.record_timestamps = false (if this doesn't work, try instead ActiveRecord::Base.record_timestamps = false at the end of the file) If you want to set only for a given model : class Foo < ActiveRecord::Base self.record_timestamps = false end

          • View Cyte

            Rails 2.1: now with better integrated caching – TheWebFellas - Ruby on Rails Development Specialists UK

            caching
            Cyted by
            Joe Dollard on Jun 4, 2009

            Rails includes five cache stores:

            * File store (ActiveSupport::Cache::FileStore) - uses individual files to store cached values.
            * Memory store (ActiveSupport::Cache::MemoryStore) - uses a simple hash to store values.
            * DRb store (ActiveSupport::Cache::DRbStore) - works just like the MemoryStore but uses a DRb server to store values.
            * Memcached store (ActiveSupport::Cache::MemCacheStore) - uses memcache and memcache-client (version 1.5.0 is bundled with Rails so there’s no need to install the Gem separately) to store values in a shared memory cache.
            * Compressed memcached store (ActiveSupport::Cache::CompressedMemCacheStore) - works just like the regular MemCacheStore but uses GZip to decompress/compress on read/write.

          • View Cyte

            Caching with Rails: An overview

            caching
            Cyted by
            Joe Dollard on Jun 4, 2009

            a great overview of caching in rails

            Caching with Rails: An overview

            Everyone caches. This guide will teach you what you need to know about avoiding that expensive round-trip to your database and returning what you need to return to those hungry web clients in the shortest time possible.

            After reading this guide, you should be able to use and configure:

            * Page, action, and fragment caching
            * Sweepers
            * Alternative cache stores
            * Conditional GET support

          • View Cyte

            Riding Rails

            authenticity token
            Cyted by
            Joe Dollard on May 7, 2009

            Looks like we will be using authenticity tokens again in rails 3, but just not for ajax

            AJAX and authenticity tokens

            If you’ve been writing much javascript by hand, you’ve discovered the nuisance of needing to include the Rails authenticity token in your requests. A closer analysis of the issues shows that there’s no need for these tokens in AJAX requests, because the same origin policy protects them. So, Rails 3 no longer checks for those tokens on AJAX requests, and that’s one less ugly bit of javascript for you to write.

          • View Cyte

            960 Grid System

            css
            Cyted by
            Joe Dollard on May 6, 2009

            Purpose

            The premise of the system is ideally suited to rapid prototyping, but it would work equally well when integrated into a production environment. There are printable sketch sheets, design layouts, and a CSS file that have identical measurements.

          • View Cyte

            Blueprint: A CSS Framework | Spend your time innovating, not replicating

            css
            Cyted by
            Joe Dollard on May 6, 2009

            Blueprint is a CSS framework, which aims to cut down on your development time. It gives you a solid foundation to build your project on top of, with an easy-to-use grid, sensible typography, useful plugins, and even a stylesheet for printing.

          • View Cyte

            Home - compass - GitHub

            css compass
            Cyted by
            Joe Dollard on May 6, 2009

            Compass is a CSS Meta-Framework that provides ports of the best of breed CSS frameworks to Sass and ready to use in your ruby-based web application or stand-alone via a simple command-line interface.

          • View Cyte

            Module: Sass

            css sass
            Cyted by
            Joe Dollard on May 6, 2009

            overcomes some frustrations of css, looks awesome.

            Sass (Syntactically Awesome StyleSheets)

            Sass is a meta-language on top of CSS that‘s used to describe the style of a document cleanly and structurally, with more power than flat CSS allows. Sass both provides a simpler, more elegant syntax for CSS and implements various features that are useful for creating manageable stylesheets.

          • View Cyte

            Module: ActiveRecord::Associations::ClassMethods

            habtm has_many
            Cyted by
            Joe Dollard on Mar 18, 2009

            Choosing which way to build a many-to-many relationship is not always simple. If you need to work with the relationship model as its own entity, use has_many :through. Use has_and_belongs_to_many when working with legacy schemas or when you never work directly with the relationship itself.

          • View Cyte

            Module: ActiveRecord::Associations::ClassMethods

            assocations rails
            Cyted by
            Joe Dollard on Mar 18, 2009

            cannot use :through with habtm unfortunately. The work around is to create a view in mysql (maybe I should write a blog post about how to do this)

            You can only use a :through query through a belongs_to or has_many association on the join model.

          • View Cyte

            A Guide to Active Record Associations

            assocations basics
            Cyted by
            Joe Dollard on Mar 18, 2009

            this page covers the basics of active record assocations

            A Guide to Active Record Associations

            This guide covers the association features of Active Record. By referring to this guide, you will be able to:

            * Declare associations between Active Record models
            * Understand the various types of Active Record associations
            * Use the methods added to your models by creating associations

          • View Cyte

            2.0 Fixtures with has_many :through ?? - Ruby on Rails: Talk | Google Groups

            fixtures habtm has_many testing
            Cyted by
            Joe Dollard on Mar 18, 2009

            good advice on when to use has_many :through and when to use has_and_belongs_to_many

            This is not currently supported as far as I know but there is a very
            good reason why. First off, the general use case for has_many :through
            is when you need to join two models AND include additional details about
            the association. For instance if we have users and magazines then the
            through association would be "subscription" BUT it also has other
            attributes such as when the subscription was made and how many times
            recurring payment has been received.

            How would you specify the additional columns of information for the
            relationship using the new fixtures method? The new way is just a list
            of fixture names and would not be able to accommodate has many through
            relationships that contained additional data.

          • View Cyte

            Module: Test::Unit::Assertions

            assertions testing
            Cyted by
            Joe Dollard on Mar 18, 2009

            list of assertions

            assert assert_block assert_equal assert_in_delta assert_instance_of assert_kind_of assert_match assert_nil assert_no_match assert_not_equal assert_not_nil assert_not_same assert_nothing_raised assert_nothing_thrown assert_operator assert_raise assert_raises assert_respond_to assert_same assert_send assert_throws

          • View Cyte

            Class: ActiveRecord::Migration

            active record
            Cyted by
            Joe Dollard on Mar 18, 2009

            column types within active record migrations

            add_column(table_name, column_name, type, options): Adds a new column to the table called table_name named column_name specified to be one of the following types: :string, :text, :integer, :float, :decimal, :datetime, :timestamp, :time, :date, :binary, :boolean. A default value can be specified by passing an options hash like { :default => 11 }. Other options include :limit and :null (e.g. { :limit => 50, :null => false }) — see ActiveRecord::ConnectionAdapters::TableDefinition#column for details.

          • View Cyte

            #6461 ([PATCH] Support nested has_many_through associations) - Rails Trac - Trac

            habtm
            Cyted by
            Joe Dollard on Mar 18, 2009

            no supported for nested has and belongs to many association in rails unfortunately. We can work around this by implementing a view within mysql

            Nice patch. Any chance you could get it to work along with HABTM associations? :)

          • View Cyte

            HowtoUseSQLite in Ruby on Rails

            test
            Cyted by
            Joe Dollard on Aug 3, 2008

            gem example

            work\rb\test>"c:\ruby\bin\ruby.exe" “c:\ruby\bin\gem” install sqlite
            Attempting local installation of ‘sqlite’
            Local gem file not found: sqlite*.gem
            Attempting remote installation of ‘sqlite’
            Select which gem

          • View Cyte

            HowtoUseSQLite in Ruby on Rails

            test
            Cyted by
            Joe Dollard on Aug 3, 2008

            lightweight SQL-compliant database. The download is about 244kb (command-line client + DLL).
            SQLite implements most

          • View Cyte

            EdgeRails in Ruby on Rails

            edgerails
            Cyted by
            Joe Dollard on Jul 30, 2008

            what is edge rails?

            EdgeRails is a term which means you are running a local copy of a developmental version of Rails (i.e., you’re on the bleeding edge). It is an alternative to the more standard GemRails, which means you are running one of the stable releases (i.e., you installed it with the GEM packaging system).

          • View Cyte

            http://ryandaigle.com/archives/2007/2

            comment fixme optimize rake todo
            Cyted by
            Joe Dollard on Jul 30, 2008

            useful way of tracking notes in code

            1
            2
            3
            4
            5
            6
            7
            8
            9
            class ContactsController < ApplicationController

            # TODO: factor out model verification to a filter
            # OPTIMIZE: optimize this
            # FIXME: it's broken
            def index
            ...
            end
            end

            With this new rake task we can now spit out a list of items we’ve annotated:
            1
            2
            3
            4
            5
            rake notes
            app/controllers/contacts_controller.rb:
            * [ 3] [TODO] factor out model verification to a filter
            * [ 4] [OPTIMIZE] optimize this
            * [ 5] [FIXME] it's broken