I'm having some issues with records I retrieve. I'm getting "stack
error to deep" when I run my script. However adding a few lines of
code prevents this from happening but I don't understand why it
doesn't work the first way (shown below)
https://gist.github.com/f3335eb8155a9cd551c5
#Fails
#-----
def simple_search
@results = Document.all("sub_tags.sub_tagtext.like" => "%#{tmp}%")
| Document.all(:description.like => "%#{tmp}%")
q.each do |val|
@results &= Document.all("sub_tags.sub_tagtext.like" => "%#{val}
%") | Document.all(:description.like => "%#{val}%")
end
# @a = Array.new
# @results.each {|r| @a << r.id}
# @results = Document.all(:id => @a)
render :results_page
end
#Succeeds (by loading the ids into an array then fetching them again)
#--------
def simple_search
#set tmp and q from params
@results = Document.all("sub_tags.sub_tagtext.like" => "%#{tmp}%")
| Document.all(:description.like => "%#{tmp}%")
q.each do |val|
@results &= Document.all("sub_tags.sub_tagtext.like" => "%#{val}
%") | Document.all(:description.like => "%#{val}%")
end
@a = Array.new
@results.each {|r| @a << r.id}
@results = Document.all(:id => @a)
render :results_page
end
-------------
results_page.html.haml
[email protected] do |r|
= r.description
- r.sub_tags.each do |tag|
= tag.tag_text #point of failure (system stack to deep)
--
You received this message because you are subscribed to the Google Groups
"DataMapper" 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/datamapper?hl=en.