Changeset 582

Show
Ignore:
Timestamp:
09/08/07 21:25:39 (1 year ago)
Author:
duane.johns..@gmail.com
Message:

Fixed magic scaffold so that it loads with and without changes to the controller. Updated dependencies.rb to latest merb expectations.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • apps/marble/trunk/app/models/comment.rb

    r500 r582  
    1717  when 'test', 'development' 
    1818    recreate_table 
     19    [ 
     20      {:user_id => 1, :title => "I Like Your Site", :body => "Dude, nice site.  Want some cheap pharmaceutical products?"} 
     21    ].each{ |row| insert row } 
    1922  end 
    2023end 
  • apps/marble/trunk/config/dependencies.rb

    r572 r582  
    11puts "Loading dependencies..." 
     2 
     3# Make the app's "deps" directory a place where gems are loaded from 
    24Gem.clear_paths 
    35Gem.path.unshift(MERB_ROOT / "deps") 
    4 $LOAD_PATH.unshift(File.join(MERB_ROOT, "lib")) 
     6 
     7# Make theh app's "lib" directory a place where ruby files get "require"d from 
     8$LOAD_PATH.unshift(MERB_ROOT / "lib") 
    59 
    610# Need to get merb_sequel from svn, package it, and install it in deps/ before the next line: 
     
    1115require 'sequel_extra/mysql_table_columns' 
    1216 
     17Merb::Server.after_app_loads do 
     18  ### Add dependencies here that must load after the application loads: 
     19 
     20  # dependency "magic_admin" # this gem uses the app's model classes 
     21end 
     22 
    1323# We pick up any old-style plugins in deps/plugins as a last-effort 
    14 Dir["#{MERB_ROOT}/deps/plugins/*/*.rb"].each { |m| require m } 
    15  
     24Dir["#{MERB_ROOT}/deps/plugins/*/init.rb"].each { |m| require m } 
  • apps/marble/trunk/config/router.rb

    r500 r582  
    3232    admin.resources(:posts, :controller => 'admin/posts') 
    3333    admin.resources(:comments, :controller => 'admin/comments') 
     34    # Default admin to Users#index 
     35    admin.match(%r[/?]).to(:controller => 'admin/users') 
    3436  end 
    3537   
  • apps/marble/trunk/lib/magic_scaffold.rb

    r570 r582  
    5656 
    5757          new_contents = "#{top.join}#{bottom.join}" 
     58           
    5859          unless new_contents == original_contents 
    5960            puts "Scaffolding #{model_class} - #{filename}:#{line}" 
     
    6162              f.write new_contents 
    6263            end 
    63              
    64             meta_def(:scaffold_loaded) { true } 
    65              
    66             load filename 
    67           end 
     64          end 
     65             
     66          meta_def(:scaffold_loaded) { true } 
     67          load filename 
    6868        end 
    6969      end