i have one field date in ruby mysql database.. i use select_date tag in view.. please help to write simple controller code(QUERY__ which fetch data from datbase.. pleaes provide one simple code..very urgent............. -- 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 -~----------~----~----~----~------~----~------~--~---
Can you provide some more information about the parameters of the query? Are you using ActiveRecord to model your domain? What is the name of the model? How is the date field supposed to effect the query (everything before that date, everything since that date)? On Mar 17, 7:22 am, Subhadip Chakraborty <rails-mailing-l...@andreas- s.net> wrote:> i have one field date in ruby mysql database.. > i use select_date tag in view.. > please help to write simple controller code(QUERY__ which fetch data > from datbase.. > pleaes provide one simple code..very urgent............. > -- > 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 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 -~----------~----~----~----~------~----~------~--~---
AndyV wrote:> Can you provide some more information about the parameters of the > query? Are you using ActiveRecord to model your domain? What is the > name of the model? How is the date field supposed to effect the query > (everything before that date, everything since that date)? > > On Mar 17, 7:22 am, Subhadip Chakraborty <rails-mailing-l...@andreas-thanks. name of the model is info..have one select_date or date_select tag.. i select one date from the list..and press submit..and in will fire one query related to this selected date and show every information related to this date..pls give some code............how will we procedd. -- 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 have one select_date tag..i choose one date from there. and then write query related to this..but the query is not run..please provide some simple code of view and controller.very urgent.. -- 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''ll assume that the date is used to select Info instances based on their created_on date. In your view you''ll have something like this: <% form_for :info, :url=>search_infos_path do |f| %> <%= f.label_for :created_on, "Select info for" %> <%= f.date_select :created_on %> <% end %> In your InfosController: def search @infos = Info.find(:all, :conditions=>{:created_on=>params[:info] [:created_on]} respond_to do |format| ... end end On Mar 17, 2:36 pm, Subhadip Chakraborty <rails-mailing-l...@andreas- s.net> wrote:> actually i have one select_date tag..i choose one date from there. > and then write query related to this..but the query is not run..please > provide some simple code of view and controller.very urgent.. > -- > 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 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 Mar 17, 8:16 pm, AndyV <a...-HmMyXyqgL2CVc3sceRu5cw@public.gmane.org> wrote:> I''ll assume that the date is used to select Info instances based on > their created_on date. In your view you''ll have something like this: > > <% form_for :info, :url=>search_infos_path do |f| %> > <%= f.label_for :created_on, "Select info for" %> > <%= f.date_select :created_on %> > <% end %> > > In your InfosController: > > def search > @infos = Info.find(:all, :conditions=>{:created_on=>params[:info] > [:created_on]}Not quite select_date (and date_select) both result in 3 separate parameters being submitted (year/month/day). If you''re passing the params hash into SomeModel.new or update_attributes (and thus leaning on the MultiparameterAssignment stuff in rails) you need to pass them into Date::civil or Time.mktime yourself (I''m pretty sure I''ve written the exact same post at least twice in the past few days - odd) Fred --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Right again, Fred. I was blowing right by that. On Mar 17, 7:31 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Mar 17, 8:16 pm, AndyV <a...-HmMyXyqgL2CVc3sceRu5cw@public.gmane.org> wrote: > > > I''ll assume that the date is used to select Info instances based on > > their created_on date. In your view you''ll have something like this: > > > <% form_for :info, :url=>search_infos_path do |f| %> > > <%= f.label_for :created_on, "Select info for" %> > > <%= f.date_select :created_on %> > > <% end %> > > > In your InfosController: > > > def search > > @infos = Info.find(:all, :conditions=>{:created_on=>params[:info] > > [:created_on]} > > Not quite select_date (and date_select) both result in 3 separate > parameters being submitted (year/month/day). If you''re passing the > params hash into SomeModel.new or update_attributes (and thus leaning > on the MultiparameterAssignment stuff in rails) you need to pass them > into Date::civil or Time.mktime yourself (I''m pretty sure I''ve written > the exact same post at least twice in the past few days - odd) > > Fred--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---