In_place_editor and lists

Hi All,

I’m trying to use the in_place_editor with a list and ended up having to
do
this:

<% for task in @tasks %>

  • <% @task = task %> <%= in_place_editor_field :task, :name %> ...

    Is there a way not to have to assign an instance variable for each task
    in
    @tasks just to use it with the in_place_editor_field?

    Thanks,
    Abdullah

  • Abdullah J. wrote:

    in @tasks just to use it with the in_place_editor_field?
    for @task in @tasks


    We develop, watch us RoR, in numbers too big to ignore.

    Hi Mark,
    That gives me this error:
    NameError in Tasks#index

    Showing app/views/tasks/list.rhtml where line #9 raised:

    undefined local variable or method `task’ for
    #<#Class:0xb7844628:0xb7844600>

    Thanks,
    Abdullah

    Abdullah J. wrote:

    That gives me this error:

    NameError in Tasks#index

    Showing /app/views/tasks/list.rhtml/ where line #9 raised:

    |undefined local variable or method `task’ for #<#Class:0xb7844628:0xb7844600>|

    Abdullah, did you delete the <% @task = task %> line, and just have:

    <% for @task in @tasks %>

  • <%= in_place_editor_field :task, :name %> <% end %>

    ?


    We develop, watch us RoR, in numbers too big to ignore.

  • Yeah, I did… I wonder why you can’t assign instance variables like
    that it
    the for loop.

    Abdullah J. wrote:

    Yeah, I did… I wonder why you can’t assign instance variables like
    that it
    the for loop.

    This should work:

    <% for @task in @tasks %>

  • <%= in_place_editor_field "task", "name" %> <% end %>