Howdy Folks, I want to use form_for to allow a user to submit a form that contains two instances of the same model. They are entering calendar dates and I want them to be able to submit 2 from the same form. Ok, so, using form_for, what is the best way to do this? form_for seems to be setup to handle a single instance in that it wants a name for the variable, etc... Has someone else done this? Any quick pointers? Beyond that, a related question. Some of these helpers support the :index option which I believe is designed to differentiate between multiple items of the same type in a form. Something like this: <%= form.text_field :event_city, :index => @event_date.id %> But, for an unsaved item, @event_date.id will be nil so what do folks use to handle this? Any help very much appreciated. Cheers, Hunter --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 9/24/06, HH <lists-HAWAbpnI61OZ1JSuHaJ1sQC/G2K4zDHf@public.gmane.org> wrote:> > I want to use form_for to allow a user to submit a form that contains two > instances of the same model. They are entering calendar dates and I want > them to be able to submit 2 from the same form. > > Ok, so, using form_for, what is the best way to do this? form_for seems to > be setup to handle a single instance in that it wants a name for the > variable, etc... > > Has someone else done this? Any quick pointers?Take a look at fields_for. Use it within a form (whether form_for or form_tag). Beyond that, a related question. Some of these helpers support the :index> option which I believe is designed to differentiate between multiple items > of the same type in a form. > > Something like this: > > <%= form.text_field :event_city, :index => @event_date.id %> > > But, for an unsaved item, @event_date.id will be nil so what do folks use > to > handle this?You''d pass :index if you had multiple event_city for a single record. Sounds like you don''t need it at all. jeremy --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jason Frankovitz
2006-Sep-28 06:40 UTC
production server on nonstandard port, "unable to connect to host" error
I have a very weird problem where no one can connect to my server ("foo.com"), even though DNS is working. I''m running my rails app on port 8000 using this command: # ./script/server webrick --port=8000 --environment=production => Booting WEBrick... => Rails application started on http://0.0.0.0:8000 => Ctrl-C to shutdown server; call with --help for options [2006-09-27 23:06:42] INFO WEBrick 1.3.1 [2006-09-27 23:06:42] INFO ruby 1.8.4 (2005-12-24) [i386-linux] [2006-09-27 23:06:42] INFO WEBrick::HTTPServer#start: pid=1345 port=8000 When someone tries to access http://foo.com:8000 from a remote location, their browser refuses to connect. I''ve tried it myself using lynx and wget and see these errors: lynx says: "Alert! Unable to connect to remote host." wget says: "connect: No route to host" If I telnet to foo.com on port 8000, telnet says: "telnet: Unable to connect to remote host: No route to host" However, I can ping foo.com successfully, and nslookup resolves it successfully too. If I re-run webrick on port 3000 (the default) everything works fine. Anyone know why I can''t choose a nonstandard port for my rails server to run on? This is really stumping me. Any tips would be very appreciated! Thanks everyone, -Jason --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Vishnu Gopal
2006-Sep-28 07:18 UTC
Re: production server on nonstandard port, "unable to connect to host" error
This might be blocked by your firewall. Vish On 9/28/06, Jason Frankovitz <jason-eoA58Jexub5zbRFIqnYvSA@public.gmane.org> wrote:> > > I have a very weird problem where no one can connect to my server > (" foo.com"), even though DNS is working. > > I''m running my rails app on port 8000 using this command: > > # ./script/server webrick --port=8000 --environment=production > => Booting WEBrick... > => Rails application started on http://0.0.0.0:8000 > => Ctrl-C to shutdown server; call with --help for options > [2006-09-27 23:06:42] INFO WEBrick 1.3.1 > [2006-09-27 23:06:42] INFO ruby 1.8.4 (2005-12-24) [i386-linux] > [2006-09-27 23:06:42] INFO WEBrick::HTTPServer#start: pid=1345 > port=8000 > > > When someone tries to access http://foo.com:8000 from a remote > location, their browser refuses to connect. I''ve tried it myself > using lynx and wget and see these errors: > > lynx says: "Alert! Unable to connect to remote host." > wget says: "connect: No route to host" > > If I telnet to foo.com on port 8000, telnet says: > "telnet: Unable to connect to remote host: No route to host" > > However, I can ping foo.com successfully, and nslookup resolves it > successfully too. If I re-run webrick on port 3000 (the default) > everything works fine. > > Anyone know why I can''t choose a nonstandard port for my rails server > to run on? This is really stumping me. Any tips would be very > appreciated! > > Thanks everyone, > -Jason > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jason Frankovitz
2006-Sep-28 18:28 UTC
Re: production server on nonstandard port, "unable to connect to host" error
You were right Vish. We needed to open port 8000 in iptables. Works fine now. Thanks! -Jason On Sep 28, 2006, at 12:18 AM, Vishnu Gopal wrote:> This might be blocked by your firewall. > > Vish > > On 9/28/06, Jason Frankovitz < jason-eoA58Jexub5zbRFIqnYvSA@public.gmane.org> wrote: > > I have a very weird problem where no one can connect to my server > (" foo.com"), even though DNS is working. > > I''m running my rails app on port 8000 using this command: > > # ./script/server webrick --port=8000 --environment=production > => Booting WEBrick... > => Rails application started on http://0.0.0.0:8000 > => Ctrl-C to shutdown server; call with --help for options > [2006-09-27 23:06:42] INFO WEBrick 1.3.1 > [2006-09-27 23:06:42] INFO ruby 1.8.4 (2005-12-24) [i386-linux] > [2006-09-27 23:06:42] INFO WEBrick::HTTPServer#start: pid=1345 > port=8000 > > > When someone tries to access http://foo.com:8000 from a remote > location, their browser refuses to connect. I''ve tried it myself > using lynx and wget and see these errors: > > lynx says: "Alert! Unable to connect to remote host." > wget says: "connect: No route to host" > > If I telnet to foo.com on port 8000, telnet says: > "telnet: Unable to connect to remote host: No route to host" > > However, I can ping foo.com successfully, and nslookup resolves it > successfully too. If I re-run webrick on port 3000 (the default) > everything works fine. > > Anyone know why I can''t choose a nonstandard port for my rails server > to run on? This is really stumping me. Any tips would be very > appreciated! > > Thanks everyone, > -Jason > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I want "rake migrate" to act on my production db, not the development one; do I just change database.yml from this: development: database: myproject_development ...to this? development: database: myproject_production Thanks! -Jason --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hello Jason ! 2006/9/28, Jason Frankovitz <jason@seethroo.us>:> I want "rake migrate" to act on my production db, not the development > one; do I just change database.yml from this:rake RAILS_ENV=production db:migrate Hope that helps ! -- François Beausoleil http://blog.teksol.info/ http://piston.rubyforge.org/ --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---
On 9/28/06, Jason Frankovitz <jason-eoA58Jexub5zbRFIqnYvSA@public.gmane.org> wrote:> > I want "rake migrate" to act on my production db, not the development > one; do I just change database.yml from this: > > development: > database: myproject_development > > > ...to this? > > development: > database: myproject_productionNo. Leave your database file as-is. Run this instead: $ rake migrate RAILS_ENV=production -- James --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
That did it... thanks JDL and Francois! -Jason On Sep 28, 2006, at 12:11 PM, JDL wrote:> > On 9/28/06, Jason Frankovitz <jason-eoA58Jexub5zbRFIqnYvSA@public.gmane.org> wrote: >> >> I want "rake migrate" to act on my production db, not the development >> one; do I just change database.yml from this: >> >> development: >> database: myproject_development >> >> >> ...to this? >> >> development: >> database: myproject_production > > No. Leave your database file as-is. Run this instead: > > $ rake migrate RAILS_ENV=production > > > -- James > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---