Hej,
Chyba mam jakieś otępienie umysłowe …
mam taki fragmencik kodu
def dijit_select(object, method, choices, select_options = {}, html_options = {})
::DojoHelpers::Dijit.form_options(html_options)
html_options.reverse_merge!({
'dojoType' => 'dijit.form.FilteringSelect',
'autoComplete' => true,
'highlightMatch' => 'all',
'ignoreCase' => true,
'hasDownArrow' => true
})
select(object, method, choices, select_options, html_options)
end
z niego w drugiej lini wywoływane jest to
[code] def form_options(html_options = {}, options = {})
core_options(html_options, options)
html_options.reverse_merge!({
'alt' => html_options['title'] || '',
'disabled' => false,
#kku ‘readOnly’ => false,
‘intermediateChanges’ => true,
‘scrollOnFocus’ => true
})
html_options[‘readOnly’] = false unless html_options[‘readOnly’] == true
end[/code]
teraz tak,
moim zamierzeniem było wstawienie do tablicy readonly na false tylko wtedy jeśli nie ma go tam już z true
html_options['readOnly'] = false unless html_options['readOnly'] == true
I teraz najdziwniejsze
stawiam sobie break pointa w lini
::DojoHelpers::Dijit.form_options(html_options)
i jak robie step over to tablica html_options ma zawartości
[Name=, displayName=html_options] Hash Hash (5 element(s))
[Name=, displayName='scrollOnFocus'] TrueClass true
[Name=, displayName='readOnly'] NilClass nil
[Name=, displayName='disabled'] NilClass nil
[Name=, displayName='alt'] String
[Name=, displayName='intermediateChanges'] TrueClass true
tak więc jakim cudem ‘readOnly’ jest nil ???
a teraz jeszcze większe czary jak wejde step into i potem wyjde to tablica ma wartości
[Name=, displayName=html_options] Hash Hash (5 element(s))
[Name=, displayName='scrollOnFocus'] TrueClass true
[Name=, displayName='disabled'] NilClass nil
[Name=, displayName='disabled'] NilClass nil
[Name=, displayName='alt'] String
[Name=, displayName='intermediateChanges'] TrueClass true
i teraz nie ma readonly?
wtf?
generalnie wszystko zależy czy na linijce
html_options['readOnly'] = false unless html_options['readOnly'] == true
zrobi sie step into czy step over…
z góry dzięki za odpowiedz
Krzysiek
ps
używam ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] i
rails 2.3.4