In_place_editor_field -- values not clickable

Hallo – I’ve just installed the latest stable version of rails, and am
following the rails recipies book’s first recipie – using
in_place_editor_field.
My problem is that the code throws no error, but the resulting fields
are not editable – the values just come up as text, rather than
clickable-then-editable fields.
Can anyone help shed any light on why this might be the case?
Cheers,
doug.

Make sure you have
<%= javascript_include_tag :defaults %>

in your page/layout’s head.

Pat

Pat M. wrote:

Make sure you have
<%= javascript_include_tag :defaults %>

in your page/layout’s head.

Pat

Yeah, that’s definately there. The layout is called ‘contacts.rhtml’ and
looks like this:

Contacts: <%= controller.action_name %> <%= stylesheet_link_tag 'scaffold' %> <%= javascript_include_tag :defaults %>

<%= flash[:notice] %>

<%= @content_for_layout %>

And the page is called ‘show.rhtml’ and is like this:

in Contact.content_columns %>

<%= column.human_name %>: <%= in_place_editor_field :contact, column.name %>

<% end %> <%= link_to 'Back', :action => 'list' %>

When they render, there’s javascript stuff in there, but it’s not doing
what it’s supposed to – for reference, a look at the source of one of
the fields is:

Name: Fat Mary

I’m no js guru, but it looks like it should be ok!

Offhand, the js looks fine. Open the javascript console in Firefox,
clear any errors (you’ll have a gazillion if you use gmail), and then
reload the page. If there are any errors it will tell you
immediately…if not, try clicking it and see if any errors come up.
If there are still no errors and it still doesn’t work, it’s probably
your js settings.

Pat

I suspect I might be getting a big ‘ah-ha!’ here, but I’m using IE6.
Should I not expect the AJAX stuff to work with IE, or even other
browsers that perhaps happen to have been to gmail?
Also, I’ve been looking in IE & not finding much about js help – is
this a Firefox feature? Should I have firefox? I’m on an XP laptop.

I suspect I might be getting a big ‘ah-ha!’ here, but I’m using IE6.
Should I not expect the AJAX stuff to work with IE, or even other
browsers that perhaps happen to have been to gmail?
Also, I’ve been looking in IE & not finding much about js help – is
this a Firefox feature? Should I have firefox? I’m on an XP laptop.

Well, I just downloaded Firefox, and have been rather delighted so far!
What it is telling me in the JavaScript console is this:

Error: Ajax.InPlaceEditor is not a constructor
Source File: http://localhost:3000/contacts/show/1
Line: 19

Unfortunately, I have no idea how to recify it, as I am simply following
a recipie in the hope of learing Ruby AJAX.
Does this suggest anything to you?
(& thanks very much for pointing me towards Firefox – I reckon it could
well turn out to be an invalueable debugging tool!)
doug.

On 3/14/06, doug livesey [email protected] wrote:

//<![CDATA[


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

Offhand, the js looks fine. Open the javascript console in Firefox,
clear any errors (you’ll have a gazillion if you use gmail), and then
reload the page. If there are any errors it will tell you
immediately…if not, try clicking it and see if any errors come up.
If there are still no errors and it still doesn’t work, it’s probably
your js settings.

Pat

On 3/14/06, doug livesey [email protected] wrote:

Source File: http://localhost:3000/contacts/show/1
Posted via http://www.ruby-forum.com/.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

hrm…do you have the latest javascripts installed? Maybe you’re
trying to do this on an old application. Do rake update_javascripts
to…update the javascripts :slight_smile:

That’s probably not it, since my guess is you’re running Rails 1.0 on
a brand new app. If that’s the case, then I really don’t know what
the problem is.

Pat

Pat M. wrote:

On 3/14/06, doug livesey [email protected] wrote:

Should I not expect the AJAX stuff to work with IE, or even other

I think you should expect the js stuff to work…it’s pretty simple js,
and it’d be pretty pointless if the helpers generated code that
doesn’t work for the majority of users. Is IE 6 the standard version,
or the early release (shows how much I use it :). I’d recommend
installing Firefox just because it has great standards support, and is
nice for development - it’s got a lot of dev-friendly features built
in. Install firefox, load up the js console to diagnose any
errors…and if it works fine in Firefox, see if you can find a js
console in IE and diagnose it there. Using Firefox to begin with
though will help you narrow the problem.

Pat

Cheers for that, & for Firefox!
Like I said above, it has pointed me to:

Error: Ajax.InPlaceEditor is not a constructor

Unfortuantely, I don’t really know what to do w/ this!

On 3/14/06, doug livesey [email protected] wrote:

Should I not expect the AJAX stuff to work with IE, or even other

I think you should expect the js stuff to work…it’s pretty simple js,
and it’d be pretty pointless if the helpers generated code that
doesn’t work for the majority of users. Is IE 6 the standard version,
or the early release (shows how much I use it :). I’d recommend
installing Firefox just because it has great standards support, and is
nice for development - it’s got a lot of dev-friendly features built
in. Install firefox, load up the js console to diagnose any
errors…and if it works fine in Firefox, see if you can find a js
console in IE and diagnose it there. Using Firefox to begin with
though will help you narrow the problem.

Pat

On 3/14/06, doug livesey [email protected] wrote:

hrm…do you have the latest javascripts installed? Maybe you’re
ruby 1.8.2 (2004-12-25) [i386-mswin32]
http://lists.rubyonrails.org/mailman/listinfo/rails

Ruby version shouldn’t matter. You said you have the latest version
of Rails - just to make sure, type ‘gem list rails’ at the command
line. You should get “rails (1.0.0)”. If not, you’ll need to ‘gem
update rails’.

To see all available tasks, type ‘rake -T’ in your app’s root dir.
It’ll give you a list of all the rake commands it recognizes, and
‘rake update_javascripts’ should be the last one on the list. If
it’s not there then something’s wrong with your Rails install, and my
guess is that it’s simply not up to date. It could be some Windows
issue, I’m not sure.

Pat

Pat M. wrote:

On 3/14/06, doug livesey [email protected] wrote:

Source File: http://localhost:3000/contacts/show/1
Posted via http://www.ruby-forum.com/.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

hrm…do you have the latest javascripts installed? Maybe you’re
trying to do this on an old application. Do rake update_javascripts
to…update the javascripts :slight_smile:

That’s probably not it, since my guess is you’re running Rails 1.0 on
a brand new app. If that’s the case, then I really don’t know what
the problem is.

Pat

No – the response I get to ruby -v is:
ruby 1.8.2 (2004-12-25) [i386-mswin32]

And I just installed the latest version of rails, too!
I tried the rake update_javascripts thing, but rake didn’t seem to
recognise the command – could that be a hint?

Ruby version shouldn’t matter. You said you have the latest version
of Rails - just to make sure, type ‘gem list rails’ at the command
line. You should get “rails (1.0.0)”. If not, you’ll need to ‘gem
update rails’.

To see all available tasks, type ‘rake -T’ in your app’s root dir.
It’ll give you a list of all the rake commands it recognizes, and
‘rake update_javascripts’ should be the last one on the list. If
it’s not there then something’s wrong with your Rails install, and my
guess is that it’s simply not up to date. It could be some Windows
issue, I’m not sure.

Pat

Hi again – I’ve run the rails update commands, but still to no avail.
I still don’t get the update_javascripts rake task, and I still get the
same error.
Perplexing!
I’ve even cleared all the caches & everything!
I guess I shall have thoroughly investigate just what I’m running!
from what I can tell, I’m up to date, but that doesn’t seem to be the
case.
Thanks very much for your input,
doug.

What was the solution to your problem, Doug? What was it in Rad Rails
that caused this problem?

I’ve been trying to figure this out all morning w/o luck. Please help.

Andrei

Include the ‘controls’ library. Defaults library doesn’t exist in these
later versions.

Will solve this issue.

Yeah, you were right!
The problem wasn’t my Ruby or Rails installation – it was Rad Rails for
Eclipse!
(Well, me being dumb’, if we’re going to be pedantic…)
I can’t believe I didn’t even think of that!
Sorry about that – hope the sense of closure helps take the sting out!
& thanks very much again – I would never have figured it out w/out your
input.
Cheers,
doug.

Andrei E. wrote:

Include the ‘controls’ library. Defaults library doesn’t exist in these
later versions.

Will solve this issue.

Hi – all I did upon realising this was scale back how much I relied
upon Rad Rails – I just use it as an editor, really – of course, I
still use Eclipse find/replace & SVN etc., so it’s still worth having,
but by going back to the console for most things, I stay totally up to
date w/ features.
Cheers,
doug.

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