From 470691f00b220be41af58ecc8efe0c4be20d2a0a Mon Sep 17 00:00:00 2001 From: Bryan Larsen Date: Thu, 27 Sep 2012 09:35:30 -0400 Subject: [PATCH] demonstration of fix --- Gemfile | 15 +++-- Gemfile.lock | 96 ++++++++++++++-------------- app/models/user.rb | 1 + app/views/front/index.dryml | 2 +- config/environments/development.rb | 13 +--- config/initializers/backtrace_silencers.rb | 2 +- config/initializers/sub_render.rb | 26 ++++++++ 7 files changed, 89 insertions(+), 66 deletions(-) create mode 100644 config/initializers/sub_render.rb diff --git a/Gemfile b/Gemfile index befb0e3..72717cd 100644 --- a/Gemfile +++ b/Gemfile @@ -1,11 +1,11 @@ source 'https://rubygems.org' -gem 'rails' +gem 'rails', '3.2.8' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' -gem 'pg' +gem 'sqlite3' # Gems used only for assets and not required # in production environments by default. @@ -39,7 +39,8 @@ gem 'jquery-ui-themes' group :development, :test do # 0.45 doesn't start - gem 'ruby-debug19' +# gem 'ruby-debug19' + gem 'debugger' gem 'mongrel', '>= 1.2.0.pre2' gem 'rspec-rails' gem 'factory_girl_rails' @@ -71,9 +72,11 @@ gem "airbrake", :git => "git://github.com/airbrake/airbrake.git" gem 'execjs' gem 'therubyracer' -gem "hobo_jquery", "1.4.0.pre9" -gem "hobo_jquery_ui", "1.4.0.pre9" +gem "hobo_jquery", :git => "https://github.com/tablatom/hobo.git" +gem "hobo_jquery_ui", :git => "https://github.com/tablatom/hobo.git" # The asset pipeline in Rails is really slow in development mode. # Hobo has a lot of assets, so speed it up with rails-dev-tweaks -gem "rails-dev-tweaks", "~> 0.6.1", :group => :development \ No newline at end of file +gem "quiet_assets" + +gem "will_paginate", :git => "git://github.com/Hobo/will_paginate.git" diff --git a/Gemfile.lock b/Gemfile.lock index 4b9d613..68c1a83 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,4 +1,10 @@ GIT + remote: git://github.com/Hobo/will_paginate.git + revision: 2695031cf4d55a6816ff36941605125418ceb8cb + specs: + will_paginate (3.0.3) + +GIT remote: git://github.com/airbrake/airbrake.git revision: c5bd5748e91a866e39e07051a719f4e8e2ec010a specs: @@ -9,26 +15,13 @@ GIT GIT remote: git://github.com/tablatom/hobo - revision: c535014c16964286f3e84d71ff8878c48cf7f0ce + revision: d207920f556c2b7e565d5d63a839db4123cbf888 specs: - dryml (1.4.0.pre9) - actionpack (~> 3.2.0) - hobo_support (= 1.4.0.pre9) - hobo_clean (1.4.0.pre9) - hobo (= 1.4.0.pre9) - hobo_fields (1.4.0.pre9) - hobo_support (= 1.4.0.pre9) - hobo_jquery (1.4.0.pre9) - hobo (= 1.4.0.pre9) - jquery-rails (~> 2.0) - hobo_jquery_ui (1.4.0.pre9) - hobo (= 1.4.0.pre9) - hobo_jquery (= 1.4.0.pre9) - jquery-ui-themes (~> 0.0.4) - hobo_rapid (1.4.0.pre9) - hobo (= 1.4.0.pre9) - hobo_support (1.4.0.pre9) - rails (~> 3.2.0) + hobo_clean (2.0.0.pre3) + hobo (= 2.0.0.pre3) + hobo_jquery_ui (= 2.0.0.pre3) + hobo_rapid (2.0.0.pre3) + hobo (= 2.0.0.pre3) GIT remote: https://github.com/chriseppstein/compass.git @@ -42,13 +35,27 @@ GIT GIT remote: https://github.com/tablatom/hobo.git - revision: c535014c16964286f3e84d71ff8878c48cf7f0ce + revision: d207920f556c2b7e565d5d63a839db4123cbf888 specs: - hobo (1.4.0.pre9) - dryml (= 1.4.0.pre9) - hobo_fields (= 1.4.0.pre9) - hobo_support (= 1.4.0.pre9) + dryml (2.0.0.pre3) + actionpack (~> 3.2.0) + hobo_support (= 2.0.0.pre3) + hobo (2.0.0.pre3) + dryml (= 2.0.0.pre3) + hobo_fields (= 2.0.0.pre3) + hobo_support (= 2.0.0.pre3) will_paginate (~> 3.0.0) + hobo_fields (2.0.0.pre3) + hobo_support (= 2.0.0.pre3) + hobo_jquery (2.0.0.pre3) + hobo_rapid (= 2.0.0.pre3) + jquery-rails (~> 2.0) + hobo_jquery_ui (2.0.0.pre3) + hobo (= 2.0.0.pre3) + hobo_jquery (= 2.0.0.pre3) + jquery-ui-themes (~> 0.0.4) + hobo_support (2.0.0.pre3) + rails (~> 3.2.0) GEM remote: https://rubygems.org/ @@ -92,7 +99,6 @@ GEM i18n (~> 0.6) multi_json (~> 1.0) addressable (2.3.2) - archive-tar-minitar (0.5.2) arel (3.0.2) bcrypt-ruby (3.0.1) builder (3.0.0) @@ -126,6 +132,13 @@ GEM nokogiri (>= 1.5.0) daemons (1.0.10) database_cleaner (0.8.0) + debugger (1.2.0) + columnize (>= 0.3.1) + debugger-linecache (~> 1.1.1) + debugger-ruby_core_source (~> 1.1.3) + debugger-linecache (1.1.2) + debugger-ruby_core_source (>= 1.1.1) + debugger-ruby_core_source (1.1.3) delayed_job (3.0.3) activesupport (~> 3.0) delayed_job_active_record (0.3.2) @@ -185,8 +198,6 @@ GEM libv8 (3.3.10.4) libwebsocket (0.1.5) addressable - linecache19 (0.5.12) - ruby_core_source (>= 0.1.4) mail (2.4.4) i18n (>= 0.4.0) mime-types (~> 1.16) @@ -217,8 +228,9 @@ GEM oauth2 (~> 0.8.0) omniauth (~> 1.0) orm_adapter (0.4.0) - pg (0.14.1) polyglot (0.3.3) + quiet_assets (1.0.1) + railties (~> 3.1) rack (1.4.1) rack-cache (1.2) rack (>= 0.4) @@ -234,9 +246,6 @@ GEM activesupport (= 3.2.8) bundler (~> 1.0) railties (= 3.2.8) - rails-dev-tweaks (0.6.1) - actionpack (~> 3.1) - railties (~> 3.1) railties (3.2.8) actionpack (= 3.2.8) activesupport (= 3.2.8) @@ -260,16 +269,6 @@ GEM activesupport (>= 3.0) railties (>= 3.0) rspec (~> 2.11.0) - ruby-debug-base19 (0.11.25) - columnize (>= 0.3.1) - linecache19 (>= 0.5.11) - ruby_core_source (>= 0.1.4) - ruby-debug19 (0.11.6) - columnize (>= 0.3.1) - linecache19 (>= 0.5.11) - ruby-debug-base19 (>= 0.11.19) - ruby_core_source (0.1.5) - archive-tar-minitar (>= 0.5.2) rubyzip (0.9.9) sass (3.2.1) sass-rails (3.2.5) @@ -285,6 +284,7 @@ GEM hike (~> 1.2) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) + sqlite3 (1.3.6) therubyracer (0.10.2) libv8 (~> 3.3.10) thin (1.4.1) @@ -302,7 +302,6 @@ GEM multi_json (~> 1.0, >= 1.0.2) warden (1.2.1) rack (>= 1.0) - will_paginate (3.0.3) xpath (0.1.4) nokogiri (~> 1.3) @@ -317,6 +316,7 @@ DEPENDENCIES compass! cucumber-rails database_cleaner + debugger delayed_job_active_record devise email_spec (>= 1.0) @@ -326,8 +326,8 @@ DEPENDENCIES factory_girl_rails hobo! hobo_clean! - hobo_jquery (= 1.4.0.pre9) - hobo_jquery_ui (= 1.4.0.pre9) + hobo_jquery! + hobo_jquery_ui! hobo_rapid! hominid jasmine @@ -336,12 +336,12 @@ DEPENDENCIES mongrel (>= 1.2.0.pre2) omniauth omniauth-facebook - pg - rails - rails-dev-tweaks (~> 0.6.1) + quiet_assets + rails (= 3.2.8) rspec-rails - ruby-debug19 sass-rails (~> 3.2.3) + sqlite3 therubyracer thin uglifier (>= 1.0.3) + will_paginate! diff --git a/app/models/user.rb b/app/models/user.rb index bcc6cc3..5721248 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -8,6 +8,7 @@ class User < ActiveRecord::Base administrator :boolean, :default => false timestamps end + attr_accessible :name, :email_address, :password, :password_confirmation # This gives admin rights and an :active state to the first sign-up. # Just remove it if you don't want that diff --git a/app/views/front/index.dryml b/app/views/front/index.dryml index 23a33e3..cead2ea 100644 --- a/app/views/front/index.dryml +++ b/app/views/front/index.dryml @@ -19,7 +19,7 @@ <% end -%> - <%= render :partial => "example" %> + <%= sub_render :partial => "example" %> diff --git a/config/environments/development.rb b/config/environments/development.rb index 052247b..a9a8063 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,4 +1,7 @@ Dramagame::Application.configure do + # Hobo: tell ActiveReload about dryml + config.watchable_dirs[File.join(config.root, 'app/view')] = ['dryml'] + # Settings specified here will take precedence over those in config/application.rb # In the development environment your application's code is reloaded on @@ -34,14 +37,4 @@ Dramagame::Application.configure do # Expands the lines which load the assets config.assets.debug = true - - # By default, rails-dev-tweaks also applies to XHR, but that's not a great default for Hobo - config.dev_tweaks.autoload_rules do - keep :all - - skip '/favicon.ico' - skip :assets - keep :xhr - keep :forced - end end diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index 59385cd..56ddc8d 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -4,4 +4,4 @@ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. -# Rails.backtrace_cleaner.remove_silencers! +Rails.backtrace_cleaner.remove_silencers! diff --git a/config/initializers/sub_render.rb b/config/initializers/sub_render.rb new file mode 100644 index 0000000..40f0eda --- /dev/null +++ b/config/initializers/sub_render.rb @@ -0,0 +1,26 @@ +module ActionView::Helpers::RenderingHelper + def sub_render(options = {}) + partial_renderer = view_renderer.send(:_partial_renderer) + partial_renderer.send(:setup, self, options, nil) + template = partial_renderer.send(:find_partial) + template.sub_render(self, options) + end +end + + +class ActionView::Template + def sub_render(view, locals, buffer=nil, &block) + ActiveSupport::Notifications.instrument("!render_template.action_view", :virtual_path => @virtual_path) do + saved_source = @source + compile!(view) + unless view.respond_to?(method_name) + @compiled = false + compile!(view) + end + @source = saved_source if @source.nil? + view.send(method_name, locals, buffer, &block) + end + rescue Exception => e + handle_render_error(view, e) + end +end -- 1.7.9.5