Hello, I really don''t understand how to use in_place_editor_field In my controller : class Admin::CategoriesController < Admin::BaseController in_place_edit_for :category, :title def list @categories = Category.find_all end end In the view list.rhtml <% @categories.each do |c| %> <td><%= in_place_editor_field :c, c.title %></td> # snip <% end %> I get error Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id I''ve tried in_place_editor_field :c, ''title'' in_place_editor_field :c, :title in_place_editor_field :c, ''c.title'' nothing work, what is the right syntax ? Thank you -- Posted via http://www.ruby-forum.com/.
Skipped content of type multipart/mixed-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 250 bytes Desc: OpenPGP digital signature Url : http://wrath.rubyonrails.org/pipermail/rails/attachments/20060404/4df64555/signature.bin
I have the exact same result when I try. Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id Is there some documentation on this somewhere? We must obviously be using it wrong... -Andy On 4/4/06, Mats Lindblad <mats.lindblad@it.su.se> wrote:> Nuno wrote: > > Hello, I really don''t understand how to use in_place_editor_field > > > > In my controller : > > class Admin::CategoriesController < Admin::BaseController > > in_place_edit_for :category, :title > > > > def list > > @categories = Category.find_all > > end > > > > end > > > > In the view list.rhtml > > <% @categories.each do |c| %> > > <td><%= in_place_editor_field :c, c.title %></td> > > # snip > > <% end %> > > > > I get error > > Called id for nil, which would mistakenly be 4 -- if you really wanted > > the id of nil, use object_id > > > > I''ve tried > > in_place_editor_field :c, ''title'' > > in_place_editor_field :c, :title > > in_place_editor_field :c, ''c.title'' > > > > nothing work, what is the right syntax ? > > > > Thank you > > > > Have you tried removing the colon (no fart jokes, please...;) > <%= in_place_editor_field c, c.title %> > > -- > ======================================> | MVH Mats Lindblad | > | Systemutvecklare / Webbutvecklare | > | +46-8-6747466 | > | Enheten f?r IT och media | > | <http://www.it.su.se/> | > | <http://www.su.se/> | > | Stockholms universitet | > | S-106 91 STOCKHOLM | > ======================================> > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > >
Andrew D. Goodfellow wrote:> I have the exact same result when I try. > > Called id for nil, which would mistakenly be 4 -- if you really wanted > the id of nil, use object_id > > Is there some documentation on this somewhere? We must obviously be > using it wrong... > > -AndyOkay, I found it but it''s really really weird <% @categories.each do |c| %> <%= @category = c; in_place_editor_field :category, :title %> # snip <% end %> Or may we might write ? <% @categories.each do |@c| %> <%= in_place_editor_field :c, :title %> # snip <% end %> Didn''t tried the last one I really don''t understand why a local object instance doesn''t do the job -- Posted via http://www.ruby-forum.com/.