logo       

Re: InPlaceEditor trouble: msg#00066

lang.ruby.rails.spinoffs

Subject: Re: InPlaceEditor trouble

In Rails the best way is probably to use the URL itself rather than a
parameter. Like this:

new Ajax.InPlaceEditor('title-<%= book.id -%>',
<%= url_for :action => 'update_book_title', :id => book.id %>);

I don't think the error you're getting is related to the InPlaceEditor
at all. It's probably some mistake or typo you've done in your action.

On 11/12/05, R. Saccon <rsaccon-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx> wrote:
> Hi all
>
> this is my first post to this list. Im am trying to use the InPlaceEditor,
> but I only manage to make it work in very simple case as in teh demo on the
> wiki. In my case I have a list of records ("books") with different fields
> and each field has an InPlaceEditor. My problem is how to pass teh id of the
> record to the update action at the controller, I tried to define the
> InPlaceEditor with following callback (for manually building the argumetnd
> for the reqeust)
>
> <script type="text/javascript">
> new Ajax.InPlaceEditor('title-<%= book.id -%>',
> 'update_book_title',
> { callback: function(value) { return 'value=' +
> value + '&id=' + <%= book.id -%>}});
> </script>
>
>
> I get a javascript error saying:
>
> ArgumentError in
> MyController#update_book_title
> wrong number of arguments (1 for 2)
>
> the raw post look like this: value=3333&id=30&_=
>
>
>
> Well, how can I pass the id of the record (or anythning else beside of the
> value) to the controller ?
>
> regards
> --
> Roberto Saccon - http://rsaccon.com
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@xxxxxxxxxxxxxxxx
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
>
>


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise