Changeset 268

Show
Ignore:
Timestamp:
02/11/06 07:40:40 (3 years ago)
Author:
lazyatom
Message:

Default table names now respect any set prefix/suffix from ActiveRecord? (Ticket #67)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • login_engine/branches/rb_1.0/CHANGELOG

    r247 r268  
    1 SVN 
     1*SVN* 
    22 
    3 1.0.1 
    4  
     3- Default table names now respect any set prefix/suffix from ActiveRecord (Ticket #67) 
    54- Removed errant closing DIV tag in views/user/edit.rhtml (Ticket #68) 
    65- do_delete_user() should delete the user given as a parameter, not @user (Ticket #65) 
  • login_engine/branches/rb_1.0/db/migrate/001_initial_schema.rb

    r106 r268  
    11class InitialSchema < ActiveRecord::Migration 
    22  def self.up 
     3    # NOTE that we don't need to wrap the table name here, since Migrations 
     4    # will do it whether we want it to or not. 
    35    create_table LoginEngine.config(:user_table), :force => true do |t| 
    46      t.column "login", :string, :limit => 80, :default => "", :null => false 
  • login_engine/branches/rb_1.0/init_engine.rb

    r201 r268  
    33require 'login_engine' 
    44 
    5 # TODO: why do I have to include these here, when including them in login_engine.rb should be sufficient? 
    6 #require 'authenticated_user' 
    7 #require 'authenticated_system' 
     5module ::LoginEngine::Version 
     6  Major = 1 # change implies compatibility breaking with previous versions 
     7  Minor = 0 # change implies backwards-compatible change to API 
     8  Release = 1 # incremented with bug-fixes, updates, etc. 
     9end 
    810 
     11Engines.current.version = LoginEngine::Version 
     12 
     13# send the helpers and modules automatically....? 
    914#ApplicationController.send(:include, LoginEngine) 
    1015#ApplicationHelper.send(:include, LoginEngine) 
  • login_engine/branches/rb_1.0/lib/login_engine.rb

    r201 r268  
    5252    config :user_table, "user" 
    5353  end 
    54  
     54   
    5555  # controls whether or not email is used 
    5656  config :use_email_notification, true 
  • login_engine/branches/rb_1.0/lib/login_engine/authenticated_user.rb

    r192 r268  
    99      base.class_eval do 
    1010 
    11         # use the table name given 
    12         set_table_name LoginEngine.config(:user_table) 
     11        # use the table name given. NOTE that this will wrap the table name 
     12        # using the set prefix/suffix. TODO: this behaviour isn't ideal, but it 
     13        # is necessary since migrations will ALWAYS wrap using the prefix/suffix. 
     14        # To explicitly and COMPLETELY set a unique table name, create a version 
     15        # of the User model in your own application and use set_table_name there. 
     16        set_table_name wrapped_table_name(LoginEngine.config(:user_table)) 
    1317 
    1418        attr_accessor :new_password 
  • login_engine/branches/rb_1.0/test/functional/user_controller_test.rb

    r128 r268  
    1010  # load the fixture into the developer-specified table using the custom 
    1111  # 'fixture' method. 
    12   fixture :users, :table_name => LoginEngine.config(:user_table), :class_name => "User" 
     12  fixture :users, :class_name => "User", 
     13          :table_name => ActiveRecord::Base.wrapped_table_name(LoginEngine.config(:user_table)) 
    1314   
    1415  def setup 
  • login_engine/branches/rb_1.0/test/unit/user_test.rb

    r107 r268  
    33 
    44  # load the fixture into the developer-specified table using the custom 
    5   # 'fixture' method. 
    6   fixture :users, :table_name => LoginEngine.config(:user_table), :class_name => "User" 
     5  # 'fixture' method. Note that it is necessary at the moment to explicitly 
     6  # wrap the table name. TODO: determine the table name from the Class object. 
     7  fixture :users, :class_name => "User",  
     8          :table_name => ActiveRecord::Base.wrapped_table_name(LoginEngine.config(:user_table)) 
    79  
    810  def setup