Skip to content

Commit

Permalink
Fixed some issues with support code not being loaded at the time we'r…
Browse files Browse the repository at this point in the history
…e trying to use it.

So I reverted __DIR__ out of a couple spots. Minor issue, problem solved, next please. :-)

Other minor documentation update to NamingConventions.
  • Loading branch information
sam committed Mar 18, 2008
1 parent 439ea5e commit e344f3d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion environment.rb
@@ -1,6 +1,6 @@
unless defined?(INITIAL_CLASSES)
# Require the DataMapper, and a Mock Adapter.
require __DIR__ + 'lib/data_mapper'
require File.join(File.dirname(__FILE__), 'lib', 'data_mapper')
require __DIR__ + 'spec/mock_adapter'

adapter = ENV["ADAPTER"] || "sqlite3"
Expand Down
11 changes: 9 additions & 2 deletions lib/data_mapper/naming_conventions.rb
Expand Up @@ -6,15 +6,22 @@ module DataMapper
# The default is UnderscoredAndPluralized.
# You assign a naming convention like so:
#
# DataMapper::Repository.container_naming_convention = NamingConventions::Underscored
# repository(:default).adapter.resource_naming_convention = NamingConventions::Underscored
#
# You can also easily assign a custom convention with a Proc:
#
# DataMapper::Repository.resource_naming_convention = lambda do |value|
# repository(:default).adapter.resource_naming_convention = lambda do |value|
# 'tbl' + value.camelize(true)
# end
#
# Or by simply defining your own module in NamingConventions that responds to ::call.
#
# NOTE: It's important to set the convention before accessing your models since the resource_names
# are cached after first accessed. DataMapper.setup(name, uri) returns the Adapter for convenience,
# so you can use code like this:
#
# adapter = DataMapper.setup(:default, "mock://localhost/mock")
# adapter.resource_naming_convention = DataMapper::NamingConventions::Underscored
module NamingConventions

module UnderscoredAndPluralized
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
@@ -1,4 +1,4 @@
require 'pp'

ENV['LOG_NAME'] = 'spec'
require __DIR__.parent + 'environment'
require File.join(File.dirname(__FILE__), '..', 'environment')

0 comments on commit e344f3d

Please sign in to comment.