In my view I have on combo in that i load all subjects from SubjectMaster table by that i got id and name of selected subject.. so I take two hidden fields name and code. After this i want to store the name and code of that selected subject in my subject table <% form_remote_for @subject do |f| %> <div> <label for="student_course">Select a Subject: </label></ div> <div class="text-input-bg"><%f.select :subject_master_id ,@subjects.map {|b| [b.name, b.id] } , {:prompt => ''Select Subject''} %> <%= f.hidden_field :name, :value => @subjects.name %> <%= f.hidden_field :code, :value => @subjects.code %> -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
On 15 April 2011 12:04, manju <mkkmugdha2@gmail.com> wrote:> In my view I have on combo in that i load all subjects from > SubjectMaster table by that i got id and name of selected subject.. > so I take two hidden fields name and code. > After this i want to store the name and code of that selected subject > in my subject table > > > <% form_remote_for @subject do |f| %> > > <div> <label for="student_course">Select a Subject: </label></ > div> > <div class="text-input-bg"><%> f.select :subject_master_id ,@subjects.map {|b| [b.name, b.id] } , > {:prompt => ''Select Subject''} %> > <%= f.hidden_field :name, :value => @subjects.name %> > <%= f.hidden_field :code, :value => @subjects.code %>These should be available in the params hash as params[:name] and params[:code]. However I am a bit confused, is not @subjects an array of subjects? If so then @subjects.name does not make sense. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
This is a question/discussion for the rubyonrails-talk<https://groups.google.com/forum/#!forum/rubyonrails-talk> list. On Fri, Apr 15, 2011 at 1:23 PM, Colin Law <clanlaw@googlemail.com> wrote:> On 15 April 2011 12:04, manju <mkkmugdha2@gmail.com> wrote: > > In my view I have on combo in that i load all subjects from > > SubjectMaster table by that i got id and name of selected subject.. > > so I take two hidden fields name and code. > > After this i want to store the name and code of that selected subject > > in my subject table > > > > > > <% form_remote_for @subject do |f| %> > > > > <div> <label for="student_course">Select a Subject: </label></ > > div> > > <div class="text-input-bg"><%> > f.select :subject_master_id ,@subjects.map {|b| [b.name, b.id] } , > > {:prompt => ''Select Subject''} %> > > <%= f.hidden_field :name, :value => @subjects.name %> > > <%= f.hidden_field :code, :value => @subjects.code %> > > These should be available in the params hash as params[:name] and > params[:code]. However I am a bit confused, is not @subjects an array > of subjects? If so then @subjects.name does not make sense. > > Colin > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.