David Mr. wrote in post #995865:
> Colin Law wrote in post #995808:
>> On 29 April 2011 17:15, David Mr. <[email protected]> wrote:
>>>
>>> Just to see if that was the cause of another error. Here is the error
>>> that happens when it is not commented out:
>>>
>>> NoMethodError in SearchesController#create
>>>
>>> undefined method `each' for true:TrueClass
>>>
>>> /home/brad/Documents/blogazer/app/models/search.rb:201:in
>>> `set_from_sources'
>>> /home/brad/Documents/blogazer/app/models/search.rb:107:in `execute'
>>
>> I think you need to look at the line above in search.rb.  It suggests
>> you are calling each for something that is not a collection but has
>> the value true.
>>
>> Colin
>
> Hmmm...
> Here is the code from around line 201 in search.rb:
>
> def set_from_sources(sources)
>     final = Set.new
>      sources.each do |source|
>       p = Page.find_by_id source
>       h = YAML.load(p.data)
>       final.merge h.keys
>     end
>     final
>   end
>
> Here is line 107 in search.rb:
>  gamma[:D] = set_from_sources(gamma[:C]) - (txv[:a] + txv[:b])
>
> If sources is empty from the form data not getting passed to it or
> sources getting assigned invalid data could that be causing the error?
> Please ignore my rails stupidity.  Thanks

Just found out if I leave the form fields empty and hit submit, the 
error changes to:

undefined method `-' for true:TrueClass

Does this help narrow things down?
Thanks

-- 
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.

Reply via email to