Topic: in place editor & belongs to

Hi, Im very inexperienced with javascript. I am using the in_place_edit_for 'profile' which works wonderfully although, I cant figure out how to get it working for the profiles children(faqs). (Profile has_many :faqs, Faq belongs_to :profile)

It returns the error ;
In ProfilesController#set_faq_answer
Couldn't find Profile with ID=5#which is id of faq but it is looking for a profile

but i cant find where its calling for a profile id, it should be faq.id

profile controller
    Profile.content_columns.each do |column|
        in_place_edit_for :profile, column.name
    end
        Faq.content_columns.each do |column|
           in_place_edit_for :faq, column.name
        end

def set_faq_answer
    faq = Faq.find(params[:id])
    faq.update_attributes(params[:faq])
    faq.save!
    end

def show_faqs
    find_profile
    find_user
    @faq = Profile.find(params[:id]).faqs.id
    render_cloud
end


            <% if @profile.faqs.any? %>
               
                <% for faq in @profile.faqs %>
                           
        <div class="faqs">
       
                    <% @faq = faq %>
                   
                   
                    <h4><b>Q.</b> <%= "" %>
                   
                    <%= in_place_editor_field :faq, 'question', {}, :id => @faq.id, :rows => 1 %></h4>
                   
                    <p><b>A. </b>
                   
                    <%= in_place_editor_field :faq, :answer, :action => 'set_faq_answer', :rows => 1 %></p>
        </div>
           
                <% end %>
       
            <% end %>

Last edited by jo s (2007-09-07 00:01:11)

Re: in place editor & belongs to

Can anyone help me on this? Any AJAX gods out there?