I defines a partial see below: <% puts @project.version text_field_tag "project_version", @project.version %> I want the project version update-to-date. The first line can print the correct version value but the text field doesn''t refresh to the new version. -- 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 -~----------~----~----~----~------~----~------~--~---
Hi, First of all, if you want to use puts in your views, use <% %> tags rather than <%= %> tags. Secondly, if you load your partials once you have your data object(@project) with appropriate value your page should display the same. But if you change the value of @project.version after the partial is loaded, it would not be reflected on the page until you reload the particular div which has the text field tag with the partial. -NAYAK On Tue, Dec 30, 2008 at 6:42 PM, Zhao Yi <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>wrote:> > I defines a partial see below: > <%> puts @project.version > text_field_tag "project_version", @project.version > %> > > I want the project version update-to-date. The first line can print the > correct version value but the text field doesn''t refresh to the new > version. > -- > 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 -~----------~----~----~----~------~----~------~--~---
NAYAK wrote:> First of all, if you want to use puts in your views, use <% %> tags > rather than <%= %> tags.> I defines a partial see below: > <%> puts @project.version > text_field_tag "project_version", @project.version > %>The above will puts the @project.version to the STDOUT stream, then will return the text_field_tag into the <%= %> location. This is a subtle hair to split (and ''p'' is more useful than ''puts'' there), but debugging out of the top of a <%= %>, while expressing its last line, is very common... -- Phlip --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Vishwanath Nayak wrote:> Hi, > > First of all, if you want to use puts in your views, use <% %> tags > rather > than <%= %> tags. > Secondly, if you load your partials once you have your data > object(@project) > with appropriate value your page should display the same. > But if you change the value of @project.version after the partial is > loaded, > it would not be reflected on the page until you reload the particular > div > which has the text field tag with the partial. > > -NAYAK > > On Tue, Dec 30, 2008 at 6:42 PM, Zhao YiHi, This is my controller code: def update_project_selection @project = Project.find(:all,:conditions=>"name=''#{selected_project}'' ") render :partial => "project_version", :layout=>false end I update the @project object before load the partial. Why does the page display the same value? Below is the view page: <% select_tag:project_selection,options_for_select(@project_names) %> <% observe_field :project_selection, :frequency => 0.5, :update => ''ajaxWrapper'', :url => {:action => ''update_project_selection''}, :with => "''project_selection=''+encodeURIComponent(value)" %> -- 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 know what the problem. I set up a wrong update value in observe_field element. -- 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 -~----------~----~----~----~------~----~------~--~---