Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

update docs; upgrade desired_ruby to ruby-1.9.2-p290

  • Loading branch information...
commit e6308a4074c19569d8117e0766663082370ce65d 1 parent bcb3ea2
@alexch alexch authored
View
1  History.txt
@@ -17,6 +17,7 @@ Deprecated or Removed:
* empty_element -- removed
* all_tags -- removed (perhaps to be replaced)
* to\_s -- use emit or to\_html instead
+* join -- use the :join option instead
== 0.8.3
View
2  cruise_build.sh
@@ -13,7 +13,7 @@ source $HOME/.rvm/scripts/rvm || exit 1
# show available (installed) rubies (for debugging)
rvm list
-for desired_ruby in ruby-1.9.2-p180 ruby-1.8.7-p334; do
+for desired_ruby in ruby-1.9.2-p290 ruby-1.8.7-p334; do
echo ""
echo "== $desired_ruby"
View
3  lib/erector/erect/erect.rb
@@ -1,5 +1,6 @@
require "optparse"
require "erector/erect/erected" # pull this out so we don't recreate the grammar every time
+require "fileutils"
module Erector
@@ -129,7 +130,7 @@ def to_html
widget = widget_class.new
#todo: skip if it's missing a no-arg constructor
dir = output_dir || File.dirname(file)
- FileUtils.mkdir_p(dir)
+ ::FileUtils.mkdir_p(dir)
output_file = "#{dir}/#{filename}.html"
File.open(output_file, "w") do |f|
f.puts widget.to_html
View
2  lib/erector/sass.rb
@@ -14,7 +14,7 @@ def sass(arg, options = {})
options = {:cache => false}.merge(options)
if arg =~ /[\w\.*]\.s?css/i
options[:filename] = arg
- sass_text = File.read(arg)
+ sass_text = File.read(arg)
else
sass_text = arg
end
View
49 web/rails.rb
@@ -295,6 +295,55 @@ def content
end
end
+
+ a.add(:title => "Instance Variables") do
+ p <<-TEXT
+Controller instance variables (sometimes called "assigns") are available to
+the view, and also to any partial
+that gets rendered by the view, no matter how deeply-nested. This effectively
+makes controller instance variables "globals". In small view hierarchies this
+probably isn't an issue, but in large ones it can make debugging and
+reasoning about the code very difficult.
+ TEXT
+
+ p <<-TEXT
+Often, large Rails applications will assign many controller instance variables.
+Sometimes these aren't used by a view: ApplicationController might assign
+variables that are used by many, but not all, views; and various other things
+may accumulate, especially if you've been using templating systems that are
+more forgiving than Erector. Erector's "needs" mechanism helps enforce
+stricter encapsulation. But if you migrate from a promiscuous Rails app
+to Erector, you're stuck using
+no "needs" declaration at all, because it needs to contain every assigned
+variable, or Erector will raise an exception.
+ TEXT
+
+ p "Two widget-class-level settings can help you with these problems."
+
+ h3 "controller_assigns_propagate_to_partials"
+
+ p <<-TEXT
+If you set this to true (and it's inherited through to subclasses), then any
+widget that's getting rendered as a partial will only have access to locals
+explicitly passed to it (render :partial => ..., :locals => ...). (This
+doesn't change the behavior of widgets that are explicitly rendered, as they
+don't have this issue.) This can allow for cleaner encapsulation of partials,
+as they must be passed everything they use and can't rely on controller
+instance variables.
+ TEXT
+
+ example
+
+ h3 "ignore_extra_controller_assigns"
+
+ p <<-TEXT
+If you set this to true (and it's inherited through to subclasses), however,
+then "needs" declarations on the widget will cause excess controller variables
+to be ignored -- they'll be unavailable to the widget (so 'needs' still means
+something), but they won't cause widget instantiation to fail, either. This
+can let a large Rails project transition to Erector more smoothly.
+ TEXT
+
}
end
Please sign in to comment.
Something went wrong with that request. Please try again.