I’m trying to use a partial from within Markaby. I haven’t been able to figure out how to access a parameter passed into the partial. Here’s the code I’m using:
h1 “Create a new note”
if @note
render :partial => ‘form/errors’, :record => @note
end
…
(that snippet, as well as the partial is stolen shamelessly from Restolog (thought converted to Markaby), which is a nice example of a REST-ful rails app)
here’s the partial, in form/_errors.mab:
unless record.nil? or record.errors.empty?
div :class => “message-error” do
p “The #{record.class.to_s.downcase} could not be saved:”
ul do
record.errors.full_messages.each
do |m|
li m.gsub(/ id /, ’ ')
end
end
end
end
The error I get is this:
notes/vendor/plugins/markaby/lib/markaby/builder.rb:203:in `method_missing': no such method `record'
Anyone know what I’m missing here? I suspect that there’s a special way to access parameters in partials for Markaby, but I haven’t been able to figure out what it is.
I like it. General impressions are that it’s cleaner than ERB. I’m not working with a designer, though. If I were, I might use ERB instead as it seems like that would be easier for a designer to work with.
My only frustration is the lack of documentation, particularly around things that work differently than ERB (such as this partial thing).
Other than that, I like it better than ERB. It certainly means less angle-bracket typing, which is nice.