Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use in index scaffold view #1

Open
eggie5 opened this issue Nov 8, 2009 · 1 comment
Open

Cannot use in index scaffold view #1

eggie5 opened this issue Nov 8, 2009 · 1 comment

Comments

@eggie5
Copy link

eggie5 commented Nov 8, 2009

This works when I use it in a scaffold edit view but it doesn't work when I use it in the index scaffold view? What is this?

I get an error similar to this:

Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id

My view code for index is standard like this:

<% @dogs.each do |dog| %>

<%= in_place_editor_field :dog, 'age' %> ....

The problem is in this code:

def in_place_editor_field(object, method, tag_options = {}, in_place_editor_options = {})
instance_tag = ::ActionView::Helpers::InstanceTag.new(object, method, self)

How can I adapt this to work in my index view?

@ghost
Copy link

ghost commented Jan 9, 2010

I just saw your comment, so it might be a bit late for you if you haven't figured it out by now...

<% @dogs.each do |dog| %> should actually be
<% for @Dog in @dogs%>

In Place Editing requires instance variables to work... like you rightly point out in the code. Local variables just don't cut it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant