View code confusion

I am trying to do this inside a view template (pass 3 values,
facility.id, @inc_beg_date and @inc_end_date)…

<% for incident in IncidentReport.include facility.id @inc_beg_date
@inc_end_date %>

and the error I get is
compile error
script/…/config/…/app/views/reports/facilities/incident_report.rhtml:39:
syntax error, unexpected tIVAR, expecting kDO_COND or ‘:’ or ‘\n’ or ‘;’
for incident in IncidentReport.include facility.id @inc_beg_date
@inc_end_date ; _erbout.concat “\n”
^
script/…/config/…/app/views/reports/facilities/incident_report.rhtml:65:
syntax error, unexpected kEND, expecting $end

and if I put commas in to separate the values, like this,
<% for incident in IncidentReport.include facility.id, @inc_beg_date,
@inc_end_date %>
I get
script/…/config/…/app/models/incident_report.rb:16: syntax error,
unexpected $end, expecting kEND

and if I enclose in parens the errors are the same

How do I pass 3 values from within view code (because I can pass 1 value
no problem)

Craig

Get freelance or telecom-job here!!
http://freelance.telecom.googlepages.com

Steve thanks - I actually figured it out - it drove me crazy and I had
to walk away from it.

For completeness, there were 2 problems so that everything I tried
wouldn’t work until I examined each and every error message and it
turned out there was a syntax error in my model which was receiving this
call and the error message was so similar, it evaded detection for quite
some time.

Had I looked closely enough at the 2 errors that I had included…the
second one specifically referred to app/models/incident_report.rb which
was different from app/reports/facilities/incident_report.rb

;-(

Ultimately, the 3 values passed exactly as I had tried it (required
commas)

<% for incident in IncidentReport.include facility.id, @inc_beg_date,
@inc_end_date %>

As RoseAnn Rosannadanna says…it’s always sumthin’

Craig

Craig–

I didn’t see a reply to your question. What is the type of
IncidentReport and what are you trying to do with the resultant values?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs