Module: Camping::Models

### Home Classes Methods

### In Files

- lib/camping/ar.rb
- lib/camping-unabridged.rb

### Namespace

- MODULE Camping::Models::Base

### Files

- CHANGELOG
- COPYING

### Class/Module Index

Quicksearch

- Camping
- Camping::Base
- Camping::Controllers
- Camping::Cookies
- Camping::H
- Camping::Helpers
- Camping::Models
- Camping::Models::Base
- Camping::Reloader
- Camping::Server
- Camping::Server::Options
- Camping::Server::XSendfile
- Camping::Session
- Camping::Views
- Camping::X

No matching classes.

# Camping::Models

Models is an empty Ruby module for housing model classes derived from ActiveRecord::Base. As a shortcut, you may derive from Base which is an alias for ActiveRecord::Base.

    module Camping::Models
      class Post < Base; belongs_to :user end
      class User < Base; has_many :posts end
    end

## Where Models are Used

Models are used in your controller classes. However, if your model class name conflicts with a controller class name, you will need to refer to it using the Models module.

    module Camping::Controllers
      class Post < R '/post/(\d+)'
        def get(post_id)
          @post = Models::Post.find post_id
          render :index
        end
      end
    end

Models cannot be referred to in Views at this time.

### Constants

A
Base

  Base is an alias for ActiveRecord::Base. The big warning I'm going to give you about this: *Base overloads table_name_prefix.* This means that if you have a model class Blog::Models::Post, it's table name will be `blog_posts`.

  ActiveRecord is not loaded if you never reference this class. The minute you use the ActiveRecord or Camping::Models::Base class, then the ActiveRecord library is loaded.

[Validate]

Generated with the Darkfish Rdoc Generator 2.