Frederick Cheung wrote:
>> But I'm not using an array!.. Am I missing something?
>
> Yes :-)
> here drop is an array (the first element is the key, the second is the
> value)
> Typically one using each with a hash, one does
> some_hash.each do |key, value|
> ...
> end
All right. Fixed. :)
> lastly, why is drops a hash at all and not an array ?
I don't know, that is changed now, too. Thanks.
One last question: I'm currently replacing the {some_partial foo:bar} to
the partial like this:
content[drop[:from], drop[:to]] = render(:partial =>
"drops/#{drop[:partial]}", :locals => drop[:arguments])
But this is very buggy. The [fixnum, fixnum] method assumes that the new
thing (in my case, a partial) is of the same length as the {some_partial
foo:bar}. That means the partial is "swallowing" up the next partial if
it's too long. If my partial looks like this:
This is a test drop. Please don't edit or remove it.
and I do {some_partial foo:bar} twice I get this output:
This is a test drop. Please don’t edit or remove it.
don’t edit or remove it.
In this case the partial is longer than the {some_partial} and some of
the second instance of the partial disappears. How can I force Ruby to
replace the characters between to positions with a longer string?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---