I am trying to use Ruby on Rails'' built in in_place_editor_field helper. Which in theory makes a paragraph of text on my screen editable right where it sits. I''ve followed all of the documentation I could find very carefully, but no matter what I do it still will not work even in the simplest example. Which from my understanding, this should make a paragraph of text that reads ''description'' which I can click, edit, and save. Controller (Right under the controller declaration): in_place_edit_for :product, :description View: <%= in_place_editor_field :product, ''description'' %> In the View header: <%= javascript_include_tag :defaults %> This throws the error when I launch it: *Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id* around here: *<%= in_place_editor_field :product, ''description'' %>* This is a real bummer because I want to do something a little bit more complex, I want to edit fields in a database but it goes without saying those examples I couldn''t make work either from the get go. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 12/6/06, Nathan <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I am trying to use Ruby on Rails'' built in in_place_editor_field helper. > Which in theory makes a paragraph of text on my screen editable right > where it sits. > > I''ve followed all of the documentation I could find very carefully, but > no matter what I do it still will not work even in the simplest example. > Which from my understanding, this should make a paragraph of text that > reads ''description'' which I can click, edit, and save. > > Controller (Right under the controller declaration): > in_place_edit_for :product, :description > > View: > <%= in_place_editor_field :product, ''description'' %> > > In the View header: > <%= javascript_include_tag :defaults %> > > This throws the error when I launch it: *Called id for nil, which would > mistakenly be 4 -- if you really wanted the id of nil, use object_id* > around here: *<%= in_place_editor_field :product, ''description'' %>* This > is a real bummer because I want to do something a little bit more > complex, I want to edit fields in a database but it goes without saying > those examples I couldn''t make work either from the get go. >You need an instance variable "@product" at the time the view is rendered - do you have one? I.e.: def show @product=Product.find(params[:id]) end Same for new/create. Cheers, Max> -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Max Muermann wrote:> You need an instance variable "@product" at the time the view is > rendered - do you have one? > > I.e.: > > def show > @product=Product.find(params[:id]) > end > > Same for new/create. > > Cheers, > MaxThat''s exactly what it was, man I''ve been trying to understand how this works for a whole week now. It wasn''t making any sense to me at all, this is a little bit better. However now when I try to make a change to the paragraph stored in my database it throws a pop-up exception error. Action Controller: Exception caught Uninitialized constant Product -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Actually I get the same type of error using the examples on this page as well: http://wiki.script.aculo.us/scriptaculous/show/Ajax.InPlaceEditor -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I got this to work, by renaming everything from "Product" to the actual model name. Still I don''t fully understand the mechanics of how this works but at least it works now. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
May-as-well keep this topic going though, how can I have an in_place_editor_field use simple_format when not in editing mode. This is so when you aren`t editing the text, HTML will display all necessary line breaks. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---