Hello everyone. I''m begining with Ruby on Rails, and i''m facing some trouble with "ActiveAdmin with ajax." Here''s the situation: It''s a Kennel''s web site, so, while i''m creating a new dog, i have one select/options for the dog''s father, dog''s mother, and dog''s race. After select the dog''s father/mother "i can be able" to know the race from the dog i''m creating, so i need to dynamically fill the race''s option, accordinggly with his father''s or mother''s race. I know i need a javascript/ajax, and i know hot to do it with php "i know it''s pretty simple" but as i''m new with Ruby on Rails, i don''t know where and how to write these codes in active admin. If anyone could help, thanks so much! =) -- 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/msgid/rubyonrails-talk/e2431c08-529e-4280-b72a-92c184b1ee42%40googlegroups.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
On May 17, 2013, at 3:35 PM, Bruno Sapienza wrote:> Hello everyone. I''m begining with Ruby on Rails, and i''m facing some trouble with "ActiveAdmin with ajax." > > Here''s the situation: > It''s a Kennel''s web site, so, while i''m creating a new dog, i have one select/options for the dog''s father, dog''s mother, and dog''s race. > > After select the dog''s father/mother "i can be able" to know the race from the dog i''m creating, so i need to dynamically fill the race''s option, accordinggly with his father''s or mother''s race. > > I know i need a javascript/ajax, and i know hot to do it with php "i know it''s pretty simple" but as i''m new with Ruby on Rails, i don''t know where and how to write these codes in active admin. > > If anyone could help, thanks so much! =)If you''re beginning with RoR, I would seriously encourage you to first build an entire site with nothing but the core Rails framework -- no extras at all. I tried using Hobo very early in my Rails career, and I feel like it set me back quite a ways. These engines and meta-frameworks enforce their own logic on top of Rails'' and this can cause you to miss some basic concepts that you will need later. Walk then run, IOW. Walter -- 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.
On May 19, 2013, at 11:36 AM, Walter Lee Davis wrote:> > On May 17, 2013, at 3:35 PM, Bruno Sapienza wrote: > >> Hello everyone. I''m begining with Ruby on Rails, and i''m facing some trouble with "ActiveAdmin with ajax." >> >> Here''s the situation: >> It''s a Kennel''s web site, so, while i''m creating a new dog, i have one select/options for the dog''s father, dog''s mother, and dog''s race. >> >> After select the dog''s father/mother "i can be able" to know the race from the dog i''m creating, so i need to dynamically fill the race''s option, accordinggly with his father''s or mother''s race. >> >> I know i need a javascript/ajax, and i know hot to do it with php "i know it''s pretty simple" but as i''m new with Ruby on Rails, i don''t know where and how to write these codes in active admin. >> >> If anyone could help, thanks so much! =) > > If you''re beginning with RoR, I would seriously encourage you to first build an entire site with nothing but the core Rails framework -- no extras at all. I tried using Hobo very early in my Rails career, and I feel like it set me back quite a ways. These engines and meta-frameworks enforce their own logic on top of Rails'' and this can cause you to miss some basic concepts that you will need later. Walk then run, IOW. > >Here''s an article that really expands on this idea. http://everydayrails.com/2012/07/31/rails-admin-panel-from-scratch.html You might give it a quick read and see if you agree with my premise. Walter> -- > 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.
Walter I already builded an entire site and also an admin panel with RnR, (with really simple ajax), and i''m doing great stuff with active admin in this current project, the only problem is the ajax. As you said, these tools enforce their own logic on top of Rails, and this is my problem, how to do it with active admin? Maybe i have missed something, and anyway i apreciate your link, and i sure will read it, and do the examples, but if you could explain directly about how to do what i need directly in active admin, i would be really greatful! Thanks so much! On Sunday, May 19, 2013 1:12:45 PM UTC-3, Walter Lee Davis wrote:> > > On May 19, 2013, at 11:36 AM, Walter Lee Davis wrote: > > > > > On May 17, 2013, at 3:35 PM, Bruno Sapienza wrote: > > > >> Hello everyone. I''m begining with Ruby on Rails, and i''m facing some > trouble with "ActiveAdmin with ajax." > >> > >> Here''s the situation: > >> It''s a Kennel''s web site, so, while i''m creating a new dog, i have one > select/options for the dog''s father, dog''s mother, and dog''s race. > >> > >> After select the dog''s father/mother "i can be able" to know the race > from the dog i''m creating, so i need to dynamically fill the race''s > option, accordinggly with his father''s or mother''s race. > >> > >> I know i need a javascript/ajax, and i know hot to do it with php "i > know it''s pretty simple" but as i''m new with Ruby on Rails, i don''t know > where and how to write these codes in active admin. > >> > >> If anyone could help, thanks so much! =) > > > > If you''re beginning with RoR, I would seriously encourage you to first > build an entire site with nothing but the core Rails framework -- no extras > at all. I tried using Hobo very early in my Rails career, and I feel like > it set me back quite a ways. These engines and meta-frameworks enforce > their own logic on top of Rails'' and this can cause you to miss some basic > concepts that you will need later. Walk then run, IOW. > > > > > > Here''s an article that really expands on this idea. > > http://everydayrails.com/2012/07/31/rails-admin-panel-from-scratch.html > > You might give it a quick read and see if you agree with my premise. > > Walter > > > > -- > > 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-ta...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. > > To post to this group, send email to rubyonra...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<javascript:>. > > > 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 To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/71683f00-e7a9-4e32-bf38-c7f6ad6e31e1%40googlegroups.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
On May 20, 2013, at 8:40 AM, Bruno Sapienza wrote:> Walter > > I already builded an entire site and also an admin panel with RnR, (with really simple ajax), and i''m doing great stuff with active admin in this current project, the only problem is the ajax. > > As you said, these tools enforce their own logic on top of Rails, and this is my problem, how to do it with active admin? > > Maybe i have missed something, and anyway i apreciate your link, and i sure will read it, and do the examples, but if you could explain directly about how to do what i need directly in active admin, i would be really greatful! > > Thanks so much! > >I wish I had some snippet I could share here, but I haven''t ever used AA so I don''t know in how many ways it differs from "vanilla" Rails in this regard. Have you read the Rails Guides about using the unobtrusive listeners in Rails 3? http://edgeguides.rubyonrails.org/working_with_javascript_in_rails.html (Not sure why this isn''t listed in the regular guides, but there you go. Just skip the part about TurboLinks since that isn''t in Rails 3.x without an extra gem.) Now that gets you the basics of the Rails helpers for unobtrusive JavaScript. The trick in your case will be to figure out how you would structure your request if you weren''t using JS, then add the JS response layer over the top of that. What would the URL look like if you were just asking the server to build a picker containing all of the races for the parent? See if you can get the server to return an HTML response containing a single select picker alone in the page. Then make a respond_to option that returns a JSON hash of the options instead, and use your JavaScript to update the options in the second picker. (Don''t just replace the second picker, you''ll be stuck in a never-ending-loop of having to re-attach your unobtrusive listeners, as they are removed along with the original iteration of that second picker.) Walter> > On Sunday, May 19, 2013 1:12:45 PM UTC-3, Walter Lee Davis wrote: > > On May 19, 2013, at 11:36 AM, Walter Lee Davis wrote: > > > > > On May 17, 2013, at 3:35 PM, Bruno Sapienza wrote: > > > >> Hello everyone. I''m begining with Ruby on Rails, and i''m facing some trouble with "ActiveAdmin with ajax." > >> > >> Here''s the situation: > >> It''s a Kennel''s web site, so, while i''m creating a new dog, i have one select/options for the dog''s father, dog''s mother, and dog''s race. > >> > >> After select the dog''s father/mother "i can be able" to know the race from the dog i''m creating, so i need to dynamically fill the race''s option, accordinggly with his father''s or mother''s race. > >> > >> I know i need a javascript/ajax, and i know hot to do it with php "i know it''s pretty simple" but as i''m new with Ruby on Rails, i don''t know where and how to write these codes in active admin. > >> > >> If anyone could help, thanks so much! =) > > > > If you''re beginning with RoR, I would seriously encourage you to first build an entire site with nothing but the core Rails framework -- no extras at all. I tried using Hobo very early in my Rails career, and I feel like it set me back quite a ways. These engines and meta-frameworks enforce their own logic on top of Rails'' and this can cause you to miss some basic concepts that you will need later. Walk then run, IOW. > > > > > > Here''s an article that really expands on this idea. > > http://everydayrails.com/2012/07/31/rails-admin-panel-from-scratch.html > > You might give it a quick read and see if you agree with my premise. > > Walter > > > > -- > > 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-ta...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To post to this group, send email to rubyonra...-/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 > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/71683f00-e7a9-4e32-bf38-c7f6ad6e31e1%40googlegroups.com?hl=en-US. > 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.
On May 20, 2013, at 8:40 AM, Bruno Sapienza wrote:> Walter > > I already builded an entire site and also an admin panel with RnR, (with really simple ajax), and i''m doing great stuff with active admin in this current project, the only problem is the ajax. > > As you said, these tools enforce their own logic on top of Rails, and this is my problem, how to do it with active admin? > > Maybe i have missed something, and anyway i apreciate your link, and i sure will read it, and do the examples, but if you could explain directly about how to do what i need directly in active admin, i would be really greatful! > > Thanks so much! >Start here: http://www.alfajango.com/blog/rails-3-remote-links-and-forms/ (Just found that in the footer links on the aforelinked Rails Guide.) Walter> > > > On Sunday, May 19, 2013 1:12:45 PM UTC-3, Walter Lee Davis wrote: > > On May 19, 2013, at 11:36 AM, Walter Lee Davis wrote: > > > > > On May 17, 2013, at 3:35 PM, Bruno Sapienza wrote: > > > >> Hello everyone. I''m begining with Ruby on Rails, and i''m facing some trouble with "ActiveAdmin with ajax." > >> > >> Here''s the situation: > >> It''s a Kennel''s web site, so, while i''m creating a new dog, i have one select/options for the dog''s father, dog''s mother, and dog''s race. > >> > >> After select the dog''s father/mother "i can be able" to know the race from the dog i''m creating, so i need to dynamically fill the race''s option, accordinggly with his father''s or mother''s race. > >> > >> I know i need a javascript/ajax, and i know hot to do it with php "i know it''s pretty simple" but as i''m new with Ruby on Rails, i don''t know where and how to write these codes in active admin. > >> > >> If anyone could help, thanks so much! =) > > > > If you''re beginning with RoR, I would seriously encourage you to first build an entire site with nothing but the core Rails framework -- no extras at all. I tried using Hobo very early in my Rails career, and I feel like it set me back quite a ways. These engines and meta-frameworks enforce their own logic on top of Rails'' and this can cause you to miss some basic concepts that you will need later. Walk then run, IOW. > > > > > > Here''s an article that really expands on this idea. > > http://everydayrails.com/2012/07/31/rails-admin-panel-from-scratch.html > > You might give it a quick read and see if you agree with my premise. > > Walter > > > > -- > > 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-ta...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To post to this group, send email to rubyonra...-/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 > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/71683f00-e7a9-4e32-bf38-c7f6ad6e31e1%40googlegroups.com?hl=en-US. > 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.