Forum: Ruby on Rails RJS Templates & Safari?

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.
Randy M. (Guest)
on 2006-04-14 23:21
Hello,

I tried Cody F. RJS tutorial
(http://www.codyfauser.com/articles/2005/11/20/rail...)

on my railsplayground dev site and got it to work when using Firefox,
but when I tried it on Safari, nothing happens.

Then I tried this tutorial -
http://rewrite.rickbradley.com/articles/2006/02/06...

Similarly, it works fine on Firefox... but with Safari the list is not
refreshed even though the background AJAX table update is successful.

I wrote to Cody F. but he said that he was not familiar enough with
Safari to venture a guess.

Railsplayground is running ruby 1.8.4 & rails 1.1.0

Any guesses? Has anyone else run into anything similar?

Randy Marmer
John T. (Guest)
on 2006-04-14 23:44
(Received via mailing list)
On 4/14/06, randy marmer <removed_email_address@domain.invalid> wrote:
>
> Similarly, it works fine on Firefox... but with Safari the list is not
> refreshed even though the background AJAX table update is successful.


As I noted in the comments to the second link, make sure your layout
file has this in the <head> section:

<%= javascript_include_tag :defaults %>

I found the same thing... the scripts wouldn't work.

jt
Randy M. (Guest)
on 2006-04-14 23:52
John T. wrote:
> On 4/14/06, randy marmer <removed_email_address@domain.invalid> wrote:
>>
>> Similarly, it works fine on Firefox... but with Safari the list is not
>> refreshed even though the background AJAX table update is successful.
>
>
> As I noted in the comments to the second link, make sure your layout
> file has this in the <head> section:
>
> <%= javascript_include_tag :defaults %>
>
> I found the same thing... the scripts wouldn't work.
>
> jt

Ahhhh... so that was you! Thanks! Actually I did see that & included the
defaults, but I didn't put in the head section... I went ahead & added
the necessary html, but it still won't refresh the list in Safari. Have
you had success with this on Safari?
John T. (Guest)
on 2006-04-15 00:06
(Received via mailing list)
On 4/14/06, randy marmer <removed_email_address@domain.invalid> wrote:
>
> Ahhhh... so that was you! Thanks! Actually I did see that & included the
> defaults, but I didn't put in the head section... I went ahead & added
> the necessary html, but it still won't refresh the list in Safari. Have
> you had success with this on Safari?
>

Yeah, his sample worked fine for me with Safari.

jt
Randy M. (Guest)
on 2006-04-15 00:10
John T. wrote:
> On 4/14/06, randy marmer <removed_email_address@domain.invalid> wrote:
>>
>> Ahhhh... so that was you! Thanks! Actually I did see that & included the
>> defaults, but I didn't put in the head section... I went ahead & added
>> the necessary html, but it still won't refresh the list in Safari. Have
>> you had success with this on Safari?
>>
>
> Yeah, his sample worked fine for me with Safari.
>
> jt

Hmmmm... The only difference seems to be the addition of the plugin... I
did not use it since railsplayground is running rails 1.1.0 which is
supposed to include RJS... Did you run it with the plugin?
John T. (Guest)
on 2006-04-15 00:22
(Received via mailing list)
On 4/14/06, randy marmer <removed_email_address@domain.invalid> wrote:
> Hmmmm... The only difference seems to be the addition of the plugin... I
> did not use it since railsplayground is running rails 1.1.0 which is
> supposed to include RJS... Did you run it with the plugin?

Nope, I didn't install the plugin either, since I had 1.1 installed too.

Have you tried choosing "Show Javascript Console" from Safari's Debug
menu, to see if any Javascript errors are displayed (from an
unintentional mis-type)?

jt
John T. (Guest)
on 2006-04-15 00:28
(Received via mailing list)
On 4/14/06, John T. <removed_email_address@domain.invalid> wrote:
> On 4/14/06, randy marmer <removed_email_address@domain.invalid> wrote:
> > Hmmmm... The only difference seems to be the addition of the plugin... I
> > did not use it since railsplayground is running rails 1.1.0 which is
> > supposed to include RJS... Did you run it with the plugin?

One other quick thing to check, what is the DOCTYPE of your layout
.rhtml file?
Randy M. (Guest)
on 2006-04-15 00:32
John T. wrote:
> On 4/14/06, randy marmer <removed_email_address@domain.invalid> wrote:
>> Hmmmm... The only difference seems to be the addition of the plugin... I
>> did not use it since railsplayground is running rails 1.1.0 which is
>> supposed to include RJS... Did you run it with the plugin?
>
> Nope, I didn't install the plugin either, since I had 1.1 installed too.
>
> Have you tried choosing "Show Javascript Console" from Safari's Debug
> menu, to see if any Javascript errors are displayed (from an
> unintentional mis-type)?
>
> jt

Yes, I tried that... nothing shows up. I also stuck a breakpoint in
there & got this:

irb(#<#<Class:0x2590418>:0x25903c8>):001:0> @category.errors.empty?
=> true

So I'm just puzzeled by this?
Randy M. (Guest)
on 2006-04-15 00:35
John T. wrote:
> On 4/14/06, John T. <removed_email_address@domain.invalid> wrote:
>> On 4/14/06, randy marmer <removed_email_address@domain.invalid> wrote:
>> > Hmmmm... The only difference seems to be the addition of the plugin... I
>> > did not use it since railsplayground is running rails 1.1.0 which is
>> > supposed to include RJS... Did you run it with the plugin?
>
> One other quick thing to check, what is the DOCTYPE of your layout
> .rhtml file?

I didn't include one... What did you use?
John T. (Guest)
on 2006-04-15 00:50
(Received via mailing list)
On 4/14/06, randy marmer <removed_email_address@domain.invalid> wrote:

> I didn't include one... What did you use?

I just redid the example, and it's working again for me (RoR 1.1.2,
Ruby 1.8.4, OS X)

My home.rhtml layout file is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>home</title>
	<meta name="generator" content="TextMate http://macromates.com/">
	<%= javascript_include_tag :defaults %>
	<!-- Date: 2006-04-14 -->
</head>
<body>
	<%= @content_for_layout %>
</body>
</html>
Randy M. (Guest)
on 2006-04-15 01:07
John T. wrote:
> On 4/14/06, randy marmer <removed_email_address@domain.invalid> wrote:
>
>> I didn't include one... What did you use?
>
> I just redid the example, and it's working again for me (RoR 1.1.2,
> Ruby 1.8.4, OS X)
>
> My home.rhtml layout file is:
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>
> <html lang="en">
> <head>
> 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
> 	<title>home</title>
> 	<meta name="generator" content="TextMate http://macromates.com/">
> 	<%= javascript_include_tag :defaults %>
> 	<!-- Date: 2006-04-14 -->
> </head>
> <body>
> 	<%= @content_for_layout %>
> </body>
> </html>

Hey, thanks for hangin' in there with me... unfortunately that didn't
work either. Maybe I should try updating my own system with RoR 1.1.2 &
see if that makes a difference.

I may also ask the good folks at Railsplayground if they have any
ideas...

Thanks again!
John T. (Guest)
on 2006-04-15 01:11
(Received via mailing list)
On 4/14/06, randy marmer <removed_email_address@domain.invalid> wrote:
> Hey, thanks for hangin' in there with me... unfortunately that didn't
> work either. Maybe I should try updating my own system with RoR 1.1.2 &
> see if that makes a difference.
>
> I may also ask the good folks at Railsplayground if they have any
> ideas...
>
> Thanks again!

I don't suppose you have Javascript turned off in Safari's
preferences? Just a wild shot...

jt
Randy M. (Guest)
on 2006-04-15 01:58
John T. wrote:
> On 4/14/06, randy marmer <removed_email_address@domain.invalid> wrote:
>> Hey, thanks for hangin' in there with me... unfortunately that didn't
>> work either. Maybe I should try updating my own system with RoR 1.1.2 &
>> see if that makes a difference.
>>
>> I may also ask the good folks at Railsplayground if they have any
>> ideas...
>>
>> Thanks again!
>
> I don't suppose you have Javascript turned off in Safari's
> preferences? Just a wild shot...
>
> jt

Yeah... I honestly wish that were it... that's the type of thing you
hate have done but love to find = simple solution to otherwise
perplexing situation...

Thanks again!
Tom M. (Guest)
on 2006-04-15 02:19
(Received via mailing list)
Whenever Javascript stuff doesn't work, try validating
your XHTML, particularly when one browser works and
another doesn't.

http://validator.w3.org/

--
-- Tom M.
Alain R. (Guest)
on 2006-04-15 13:20
(Received via mailing list)
Tom M. wrote:
     > Whenever Javascript stuff doesn't work, try validating
     > your XHTML, particularly when one browser works and
    > another doesn't.
    > http://validator.w3.org/


One more reason to use Firefox: install the WebDeveloper plugin, and you
can validate local html pages with one key press
      Ctrl-Shift-A

You can even validate local CSS files.

Alain
Guest (Guest)
on 2006-04-15 14:47
hi there,
Put your app in production mode and I bet it works fine in Safari.
Might be the "?1144942301" junk at the end of all resource links in dev
mode that Safari doesn't like. No idea really.  But things work fine in
production.

uncomment this line in your config/environment.rb:
# ENV['RAILS_ENV'] = 'production'

restart your server.

try it out now.

p.s. it IS super strange though. And its annoying.  And all the
scriptaculous stuff seems to be fine.  weird.
Randy M. (Guest)
on 2006-04-15 16:32
Guest wrote:
> hi there,
> Put your app in production mode and I bet it works fine in Safari.
> Might be the "?1144942301" junk at the end of all resource links in dev
> mode that Safari doesn't like. No idea really.  But things work fine in
> production.
>
> uncomment this line in your config/environment.rb:
> # ENV['RAILS_ENV'] = 'production'
>
> restart your server.
>
> try it out now.
>
> p.s. it IS super strange though. And its annoying.  And all the
> scriptaculous stuff seems to be fine.  weird.

FYI:

I can't say that I get it, but I did identify rhe problem I was
having...

In the development.rb file that is created by rails 1.1, the following
line is added;

"config.action_view.debug_rjs = true"

Setting that to false worked in one dev environment, but not another
(locomotive  1.1 on the a powerbook)... In the 2nd case I had to remove
it entirely!
John T. (Guest)
on 2006-04-15 18:21
(Received via mailing list)
On 4/15/06, randy marmer <removed_email_address@domain.invalid> wrote:
> Setting that to false worked in one dev environment, but not another
> (locomotive  1.1 on the a powerbook)... In the 2nd case I had to remove
> it entirely!

Ah. That's one difference. I'm using a self-built Ruby 1.8.4 and Rails
1.1.2 (using the directions on:
<http://hivelogic.com/articles/2005/12/01/ruby_rail...

I then tried my install of Locomotive. It had the 1.0 rails bundle, so
I downloaded the 1.1 bundle packages.

When I tried running with that, I couldn't even access the app, it
wouldn't even respond. So I went to the Terminal, via Locomotive, and
did a 'sudo gem update' and let it update a bunch of gems, including
Rails 1.1.2.

Now, running under Locomotive, it works fine with Safari. And I didn't
touch that config line in the development.rb file. So, try updating
your gems, and don't forget to do a 'rake rails:update' too.

hth,

jt
Guest (Guest)
on 2006-04-21 22:56
> When I tried running with that, I couldn't even access the app, it
> wouldn't even respond. So I went to the Terminal, via Locomotive, and
> did a 'sudo gem update' and let it update a bunch of gems, including
> Rails 1.1.2.

if you have this line in your environment:
RAILS_GEM_VERSION = '1.1.2'
and you are running on a machine without that version (or in locomotive
without that version) you won't get any love from your app.  This would
have probably also worked fine for you: RAILS_GEM_VERSION = '1.1.1'.

I just mention it because its probably something a lot of people might
run into.

Thanks for the tip Randy.  I was getting sick of restarting my server
with every fart.
This topic is locked and can not be replied to.