Forum: Ruby on Rails "syntax error, unexpected tIDENTIFIER , expecting kEND" in RJS response

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Db90fac1650bf9dbd8e208c934ecdfa9?d=identicon&s=25 Jochen Kempf (jawosis)
on 2008-11-22 22:38
(Received via mailing list)
I get a "syntax error, unexpected tIDENTIFIER, expecting kEND" when
the following RJS template is rendered:

page.insert_html :bottom, :requisite_table, :partial =>
"insert_jobrequisite_select", :locals => {:job => @job, :counter =>
@counter}
page.alert("hi")


The same RJS template is rendered without errors as soon as the rjs
file has only one single javascript call - that means, the prior
example works if "page.alert("hi")" is deleted.

The strange thing about it is, that in another controller action I use
a similar rjs template (containing two javascript calls as above) and
it works.

The only difference between both rjs templates is that the problematic
one (the above example) renders a template which itself calls another
template within a loop over a collection (job.requisites each do |r|
render :partial => "requisite").

Anyone knows what is going on here and how to make this problematic
example work?

Thanks for any help!

Jochen
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-11-22 22:46
(Received via mailing list)
On Nov 22, 9:38 pm, jawosis <jochenke...@gmail.com> wrote:
> example works if "page.alert("hi")" is deleted.
> Anyone knows what is going on here and how to make this problematic
> example work?
>
Bad line endings or invisible gremlins ?

Fred
Db90fac1650bf9dbd8e208c934ecdfa9?d=identicon&s=25 Jochen Kempf (jawosis)
on 2008-11-22 23:02
(Received via mailing list)
Hi Fred,

what exactly do you mean by bad line endings?
If there would be any bad line endings in:

a) the rjs template - then, I should see the same error in the second
rjs template (the one that works) using the same syntax...which istn't
the case!
b) the partials being called in the rjs template - then, I should also
see the error when just the first line/ javascript call (the one that
calls the partials) is executed...which istn't the case!

Hmmm...then it must be the invisible gremlins?



On 22 Nov., 22:46, Frederick Cheung <frederick.che...@gmail.com>
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-11-22 23:13
(Received via mailing list)
On Nov 22, 10:01 pm, jawosis <jochenke...@gmail.com> wrote:
> Hi Fred,
>
> what exactly do you mean by bad line endings?
> If there would be any bad line endings in:
>
> a) the rjs template - then, I should see the same error in the second
> rjs template (the one that works) using the same syntax...which istn't
> the case!

Probably in the rjs template. The thing is that your editor would
probably display them in the same way, so the two files would look
identical even if they weren't. Your editor will have a show
invisibles command and a convert line endings one too, play around
with those.

Fred
Db90fac1650bf9dbd8e208c934ecdfa9?d=identicon&s=25 Jochen Kempf (jawosis)
on 2008-11-23 12:10
(Received via mailing list)
Ok - thanks a lot for your advice Fred!

I checked my line endings with another editor and in fact found some
unwanted whitespaces.
Now everything works fine!




On 22 Nov., 23:12, Frederick Cheung <frederick.che...@gmail.com>
This topic is locked and can not be replied to.