you have to add the r.id to the link dynamically which can be used by
javascript .
onclick the radio button you have to add '?
contact_reference_id=checked element id'

On Mar 11, 11:33 am, Nitin Rajora <[email protected]> wrote:
> Try this...
> INSIDE VIEW -
> -----------------------------------------------------------------------------------------------
> <% form_tag  :controller => "readings", :action =>"index" do %>
> <% for r in @readings %>
>   <div><%= radio_button_tag 'contact_preference_id', "#{r.station.id}",
> false %><%=h r.station.stats %></div>
> <%end%>
> <%= submit_tag "View Details" %>
> <% end %>
>
> INSIDE CONTROLLER -
> ------------------------------------------------------------------------------------------------
> @readings = CurrentReadings.find(:all)
> if request.post?
>       #do something
>       station = Station.find(params[:contact_preference_id])
>       @readings=CurrentReading.find_all_by_station_id(station)
>     end
>
> INSIDE MODEL-
> ------------------------------------------------------------------------------------------------
> def stats
>     "#{self.name}-#{self.unit_id}, #{self.province.nil? ? '' :
> self.province+', '} #{self.state.titleize}"
>   end
>
> good luck (You really need to modify all this according to your requirement.
> I just took an example case similar to your DATABASE)
> Nitin.
>
> On Thu, Mar 11, 2010 at 11:33 AM, Veena Jose <[email protected]> wrote:
> > Bala wrote:
> > > *<%= radio_button_tag 'contact_preference_id', '#{r.id}' %> <%=h
> > > r.station.province %>
> > > *
>
> > Still facing same problem....
> > Thanks,
> >  veena
> > --
> > Posted viahttp://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 [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<rubyonrails-talk%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to