From 898e405605aae53b037fef7235a9d985ecc360e8 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 15 Dec 2008 18:14:48 -0600 Subject: [PATCH 1/2] fixed a routing bug in the form for editing a user. not sure if it existed in rails 2.1 --- .../ansuz_user_manager/app/views/admin/users/edit.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vendor/plugins/ansuz_user_manager/app/views/admin/users/edit.html.erb b/vendor/plugins/ansuz_user_manager/app/views/admin/users/edit.html.erb index c107d1f..503cf58 100644 --- a/vendor/plugins/ansuz_user_manager/app/views/admin/users/edit.html.erb +++ b/vendor/plugins/ansuz_user_manager/app/views/admin/users/edit.html.erb @@ -3,6 +3,7 @@ <%= link_to "All Users", admin_users_path, :class => 'button icon back' %> <% end %> -<% form_for [:admin, @user] do |f| -%> +<%# form_for [:admin, @user] do |f| -%> +<% form_for :user, :url => { :action => "update" } , :html => { :method => :put } do |f| -%> <%= render :partial => 'form', :locals => { :f => f, :submit_text => "Update User" } -%> <% end -%> From 2275d5b7e366bf6e25e1d7056d166381a1dafe0e Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 15 Dec 2008 18:15:44 -0600 Subject: [PATCH 2/2] hacked around bad things happening in rails 2.1 with render_file and rails 2.2 with render :file. Themes not working in 2.2 .. --- .../lib/patches/actionview_ex.rb | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/vendor/plugins/theme_support/lib/patches/actionview_ex.rb b/vendor/plugins/theme_support/lib/patches/actionview_ex.rb index 6d6ee88..d1a4d1a 100755 --- a/vendor/plugins/theme_support/lib/patches/actionview_ex.rb +++ b/vendor/plugins/theme_support/lib/patches/actionview_ex.rb @@ -4,21 +4,29 @@ module ActionView # Extending ActionView::Base to support rendering themes class Base - alias_method :theme_support_old_render_file, :render - # Overrides the default Base#render_file to allow theme-specific views - def render_file(template_path, use_full_path = false, local_assigns = {}) + if( Rails::VERSION::STRING =~ /\A2\.2\.\d/) + alias_method :theme_support_old_render_file, :render + else + alias_method :theme_support_old_render_file, :render_file + end + # Overrides the default Base#render_file to allow theme-specific views + def render_file(template_path, use_full_path = false, local_assigns = {}) - search_path = [ - "#{RAILS_ROOT}/themes/#{controller.current_theme}/views", # for components - "#{RAILS_ROOT}/themes/#{controller.current_theme}", # for layouts - ] + search_path = [ + "#{RAILS_ROOT}/themes/#{controller.current_theme}/views", # for components + "#{RAILS_ROOT}/themes/#{controller.current_theme}", # for layouts + ] + + @finder.prepend_view_path(search_path) + local_assigns['active_theme'] = get_current_theme(local_assigns) + if( Rails::VERSION::STRING =~ /\A2\.2\.\d/) + theme_support_old_render_file :file => template_path, :layout => controller.current_theme, :locals => local_assigns + else + theme_support_old_render_file(template_path, use_full_path, local_assigns) + end + + end - @finder.prepend_view_path(search_path) - local_assigns['active_theme'] = get_current_theme(local_assigns) - # This isnt right, but it prevents breakage in 2.2.2 -james - theme_support_old_render_file :file => template_path, :layout => true, :locals => local_assigns - - end private def force_liquid?