Hello All, I want to pass conditions in respond_with like this: user = User.where("updated_at >= :start_date AND updated_at <= :end_date", {:start_date => some_date, :end_date => Time.now}) respond_with(user, :include => :sub_users) I need to pass the same parameters in case of sub users. How can I achieve this? Thanks, Avi -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/xiicnqcIABsJ. For more options, visit https://groups.google.com/groups/opt_out.
> > > I want to pass conditions in respond_with like this: > > user = User.where("updated_at >= :start_date AND updated_at <= :end_date", > {:start_date => some_date, :end_date => Time.now}) > respond_with(user, :include => :sub_users) > > I need to pass the same parameters in case of sub users. > > How can I achieve this? > > > Thanks, > Avi > >Why would you do this? The respond_with method is used to initialize a responder, which will only set the path to go to. If u need an association, you must do this on your where call. -- ----------------------------------------------------- Paulo Henrique Lopes Ribeiro Graduando em Ciência da Computação pela UNIFEI <http://www.unifei.edu.br>. Web Developer na Zertico <http://www.zertico.com> - Ruby, Ruby on Rails, PHP, HTML, CSS. Linux - Debian Lenny/Squeeze/Wheezy amd64(XEN) - Centos 5.5 x86_64 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
I want json data passing date parameter ... As users has_many sub_users I want those sub_users data also with same condition as users. Is it possible to achieve that ? ----- Reply message ----- From: "Paulo Henrique Lopes Ribeiro" <plribeiro3000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> To: <rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Subject: [Rails] respond_with conditions Date: Tue, Apr 2, 2013 6:56 pm> > > I want to pass conditions in respond_with like this: > > user = User.where("updated_at >= :start_date AND updated_at <= :end_date", > {:start_date => some_date, :end_date => Time.now}) > respond_with(user, :include => :sub_users) > > I need to pass the same parameters in case of sub users. > > How can I achieve this? > > > Thanks, > Avi > >Why would you do this? The respond_with method is used to initialize a responder, which will only set the path to go to. If u need an association, you must do this on your where call. -- ----------------------------------------------------- Paulo Henrique Lopes Ribeiro Graduando em Ciência da Computação pela UNIFEI <http://www.unifei.edu.br>. Web Developer na Zertico <http://www.zertico.com> - Ruby, Ruby on Rails, PHP, HTML, CSS. Linux - Debian Lenny/Squeeze/Wheezy amd64(XEN) - Centos 5.5 x86_64 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Sure it is possible. The only thing is, the right place isn''t inside respond_with. =p 2013/4/2 aavinash.behera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <aavinash.behera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> I want json data passing date parameter ... As users has_many sub_users I > want those sub_users data also with same condition as users. Is it possible > to achieve that ? > > > ----- Reply message ----- > From: "Paulo Henrique Lopes Ribeiro" <plribeiro3000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > To: <rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > Subject: [Rails] respond_with conditions > Date: Tue, Apr 2, 2013 6:56 pm > > > > > > > > I want to pass conditions in respond_with like this: > > > > user = User.where("updated_at >= :start_date AND updated_at <> :end_date", > > {:start_date => some_date, :end_date => Time.now}) > > respond_with(user, :include => :sub_users) > > > > I need to pass the same parameters in case of sub users. > > > > How can I achieve this? > > > > > > Thanks, > > Avi > > > > > Why would you do this? The respond_with method is used to initialize a > responder, which will only set the path to go to. If u need an association, > you must do this on your where call. > > -- > ----------------------------------------------------- > Paulo Henrique Lopes Ribeiro > Graduando em Ciência da Computação pela UNIFEI <http://www.unifei.edu.br>. > Web Developer na Zertico <http://www.zertico.com> - Ruby, Ruby on Rails, > > PHP, HTML, CSS. > Linux - Debian Lenny/Squeeze/Wheezy amd64(XEN) - Centos 5.5 x86_64 > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- ----------------------------------------------------- Paulo Henrique Lopes Ribeiro Graduando em Ciência da Computação pela UNIFEI <http://www.unifei.edu.br>. Web Developer na Zertico <http://www.zertico.com> - Ruby, Ruby on Rails, PHP, HTML, CSS. Linux - Debian Lenny/Squeeze/Wheezy amd64(XEN) - Centos 5.5 x86_64 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
If I want to fetch the json data in nested form ? On Tue, Apr 2, 2013 at 7:52 PM, Paulo Henrique Lopes Ribeiro < plribeiro3000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Sure it is possible. The only thing is, the right place isn''t inside > respond_with. =p > > > 2013/4/2 aavinash.behera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <aavinash.behera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > I want json data passing date parameter ... As users has_many sub_users I >> want those sub_users data also with same condition as users. Is it possible >> to achieve that ? >> >> >> ----- Reply message ----- >> From: "Paulo Henrique Lopes Ribeiro" <plribeiro3000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> To: <rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> >> Subject: [Rails] respond_with conditions >> Date: Tue, Apr 2, 2013 6:56 pm >> >> >> > >> > >> > I want to pass conditions in respond_with like this: >> > >> > user = User.where("updated_at >= :start_date AND updated_at <>> :end_date", >> > {:start_date => some_date, :end_date => Time.now}) >> > respond_with(user, :include => :sub_users) >> > >> > I need to pass the same parameters in case of sub users. >> > >> > How can I achieve this? >> > >> > >> > Thanks, >> > Avi >> > >> > >> Why would you do this? The respond_with method is used to initialize a >> responder, which will only set the path to go to. If u need an >> association, >> you must do this on your where call. >> >> -- >> ----------------------------------------------------- >> Paulo Henrique Lopes Ribeiro >> Graduando em Ciência da Computação pela UNIFEI <http://www.unifei.edu.br >> >. >> Web Developer na Zertico <http://www.zertico.com> - Ruby, Ruby on Rails, >> >> PHP, HTML, CSS. >> Linux - Debian Lenny/Squeeze/Wheezy amd64(XEN) - Centos 5.5 x86_64 >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > > > -- > ----------------------------------------------------- > Paulo Henrique Lopes Ribeiro > Graduando em Ciência da Computação pela UNIFEI <http://www.unifei.edu.br>. > Web Developer na Zertico <http://www.zertico.com> - Ruby, Ruby on Rails, > PHP, HTML, CSS. > > Linux - Debian Lenny/Squeeze/Wheezy amd64(XEN) - Centos 5.5 x86_64 > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.