Rodrigo Ruiz
2011-Jul-11 17:41 UTC
Help filling out a registration (I think it''s called multi tenant)
Do you know when you are filling out a registration for a new account, and you keep pressing next to fill the rest of the information in separate pages? I''d like to do that, but I have no idea how. Basically I have a company model with its information, and a contacts model, with belongs to my company (also each company has only one contact), and I''d like for the user to fill in the company specific information (like email, name, address, etc), and click next down the page to fill in the contact information (telephone, manager email, etc). Also I''d like to save it to the database only if all the information in both pages are inputed. Thank you, Rodrigo -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Everaldo Gomes
2011-Jul-11 19:12 UTC
Re: Help filling out a registration (I think it''s called multi tenant)
Hi Rodrigo, Take a look at this screencast, from Ryan Bates: http://railscasts.com/episodes/217-multistep-forms Best Regards, Everaldo On Mon, Jul 11, 2011 at 2:41 PM, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> Do you know when you are filling out a registration for a new account, and > you keep pressing next to fill the rest of the information in separate > pages? > > I''d like to do that, but I have no idea how. > > Basically I have a company model with its information, and a contacts > model, with belongs to my company (also each company has only one contact), > and I''d like for the user to fill in the company specific information (like > email, name, address, etc), and click next down the page to fill in the > contact information (telephone, manager email, etc). Also I''d like to save > it to the database only if all the information in both pages are inputed. > > Thank you, > Rodrigo > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Walter Lee Davis
2011-Jul-11 19:20 UTC
Re: Help filling out a registration (I think it''s called multi tenant)
And just FYI, multi-tenant usually means that you have one database containing separate (unrelated) client accounts, for example Basecamp. There isn''t a separate database for my Basecamp account and yours, our records are all commingled in one set of tables, and the server enforces business rules to make sure I don''t see your messages and vice-versa. Walter On Jul 11, 2011, at 3:12 PM, Everaldo Gomes wrote:> Hi Rodrigo, > > Take a look at this screencast, from Ryan Bates: http://railscasts.com/episodes/217-multistep-forms > > > Best Regards, > > Everaldo > > > On Mon, Jul 11, 2011 at 2:41 PM, Rodrigo Ruiz > <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > Do you know when you are filling out a registration for a new > account, and you keep pressing next to fill the rest of the > information in separate pages? > > I''d like to do that, but I have no idea how. > > Basically I have a company model with its information, and a > contacts model, with belongs to my company (also each company has > only one contact), and I''d like for the user to fill in the company > specific information (like email, name, address, etc), and click > next down the page to fill in the contact information (telephone, > manager email, etc). Also I''d like to save it to the database only > if all the information in both pages are inputed. > > Thank you, > Rodrigo > > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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 > . > > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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 > .-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Rodrigo Ruiz
2011-Jul-11 20:41 UTC
Re: Help filling out a registration (I think it''s called multi tenant)
thank you On Mon, Jul 11, 2011 at 4:20 PM, Walter Lee Davis <waltd-HQgmohHLjDZWk0Htik3J/w@public.gmane.org>wrote:> And just FYI, multi-tenant usually means that you have one database > containing separate (unrelated) client accounts, for example Basecamp. There > isn''t a separate database for my Basecamp account and yours, our records are > all commingled in one set of tables, and the server enforces business rules > to make sure I don''t see your messages and vice-versa. > > Walter > > > On Jul 11, 2011, at 3:12 PM, Everaldo Gomes wrote: > > Hi Rodrigo, >> >> Take a look at this screencast, from Ryan Bates: http://railscasts.com/** >> episodes/217-multistep-forms<http://railscasts.com/episodes/217-multistep-forms> >> >> >> Best Regards, >> >> Everaldo >> >> >> On Mon, Jul 11, 2011 at 2:41 PM, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> wrote: >> Do you know when you are filling out a registration for a new account, and >> you keep pressing next to fill the rest of the information in separate >> pages? >> >> I''d like to do that, but I have no idea how. >> >> Basically I have a company model with its information, and a contacts >> model, with belongs to my company (also each company has only one contact), >> and I''d like for the user to fill in the company specific information (like >> email, name, address, etc), and click next down the page to fill in the >> contact information (telephone, manager email, etc). Also I''d like to save >> it to the database only if all the information in both pages are inputed. >> >> Thank you, >> Rodrigo >> >> >> -- >> 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<rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> >> . >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe@**googlegroups.com<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> >> . >> For more options, visit this group at http://groups.google.com/** >> group/rubyonrails-talk?hl=en<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 rubyonrails-talk@googlegroups.**com<rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> >> . >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe@**googlegroups.com<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> >> . >> For more options, visit this group at http://groups.google.com/** >> group/rubyonrails-talk?hl=en<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 rubyonrails-talk@googlegroups.**com<rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe@**googlegroups.com<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at http://groups.google.com/** > group/rubyonrails-talk?hl=en<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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Rodrigo Ruiz
2011-Jul-11 20:42 UTC
Re: Help filling out a registration (I think it''s called multi tenant)
Thank you very much, I''m watching the video right now, but I think this is exactly what I was looking for On Mon, Jul 11, 2011 at 4:12 PM, Everaldo Gomes <everaldo.gomes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> Hi Rodrigo, > > Take a look at this screencast, from Ryan Bates: > http://railscasts.com/episodes/217-multistep-forms > > > Best Regards, > > Everaldo > > > On Mon, Jul 11, 2011 at 2:41 PM, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: > >> Do you know when you are filling out a registration for a new account, and >> you keep pressing next to fill the rest of the information in separate >> pages? >> >> I''d like to do that, but I have no idea how. >> >> Basically I have a company model with its information, and a contacts >> model, with belongs to my company (also each company has only one contact), >> and I''d like for the user to fill in the company specific information (like >> email, name, address, etc), and click next down the page to fill in the >> contact information (telephone, manager email, etc). Also I''d like to save >> it to the database only if all the information in both pages are inputed. >> >> Thank you, >> Rodrigo >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Rodrigo Ruiz
2011-Jul-11 23:15 UTC
Re: Help filling out a registration (I think it''s called multi tenant)
I watched the screencast, and it covers the multi step form thing but with only one model. I''d like to the the same thing but each step would be a different model. How can I do that? On Monday, July 11, 2011, Everaldo Gomes <everaldo.gomes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Rodrigo, > > Take a look at this screencast, from Ryan Bates: http://railscasts.com/episodes/217-multistep-forms > > > Best Regards, > > Everaldo > > > On Mon, Jul 11, 2011 at 2:41 PM, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Do you know when you are filling out a registration for a new account, and you keep pressing next to fill the rest of the information in separate pages? > I''d like to do that, but I have no idea how. > > > > Basically I have a company model with its information, and a contacts model, with belongs to my company (also each company has only one contact), and I''d like for the user to fill in the company specific information (like email, name, address, etc), and click next down the page to fill in the contact information (telephone, manager email, etc). Also I''d like to save it to the database only if all the information in both pages are inputed. > > > > Thank you,Rodrigo > > > > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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. > > > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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. >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Hassan Schroeder
2011-Jul-11 23:29 UTC
Re: Re: Help filling out a registration (I think it''s called multi tenant)
On Mon, Jul 11, 2011 at 4:15 PM, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I watched the screencast, and it covers the multi step form thing but > with only one model. > I''d like to the the same thing but each step would be a different > model. How can I do that?1 page, 1 form, 1 model -- sounds typical; what''s the problem? -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Rodrigo Ruiz
2011-Jul-12 00:55 UTC
Re: Help filling out a registration (I think it''s called multi tenant)
Problem is I want more than one model as I explained before. On Tuesday, July 12, 2011, Hassan Schroeder <hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Mon, Jul 11, 2011 at 4:15 PM, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> I watched the screencast, and it covers the multi step form thing but >> with only one model. >> I''d like to the the same thing but each step would be a different >> model. How can I do that? > > 1 page, 1 form, 1 model -- sounds typical; what''s the problem? > > -- > Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > http://about.me/hassanschroeder > twitter: @hassan > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hassan Schroeder
2011-Jul-12 01:11 UTC
Re: Re: Help filling out a registration (I think it''s called multi tenant)
On Mon, Jul 11, 2011 at 5:55 PM, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Problem is I want more than one model as I explained before.So each "step" is a different page, different model -- again, what is the issue? Complete one, go to the next. -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Everaldo Gomes
2011-Jul-12 01:15 UTC
Re: Re: Help filling out a registration (I think it''s called multi tenant)
Take a look in these screencasts: http://railscasts.com/episodes?utf8=%E2%9C%93&search=model http://railscasts.com/episodes/196-nested-model-form-part-1 http://railscasts.com/episodes/197-nested-model-form-part-2 Maybe they can help you. Best regards, Everaldo On Mon, Jul 11, 2011 at 10:11 PM, Hassan Schroeder < hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Mon, Jul 11, 2011 at 5:55 PM, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > Problem is I want more than one model as I explained before. > > So each "step" is a different page, different model -- again, what is > the issue? Complete one, go to the next. > > -- > Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > http://about.me/hassanschroeder > twitter: @hassan > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi All, When I enter a Start Date in the text field as "07/11/2011" it gets stored in the database as "2011-11-07" instead of "2011-07-11". This change happens before the column is available in the controller. Is there some Rails setting that will make this happen magically or do I have to have some fun with date parsing? Thanks! **Leigh --------------------- [_form.html.erb] <%= f.label :start_date, :class => ''label'' %><br /> <%= f.text_field :start_date, :size => 15 %> [jobs_controller.rb] def new @job = Job.new @job.rate = 125 respond_to do |format| format.html # new.html.erb format.json { render json: @job } end end [schema.rb] t.date "start_date" -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Rodrigo Ruiz
2011-Jul-12 04:12 UTC
Re: Re: Help filling out a registration (I think it''s called multi tenant)
I want to save all together, not step by step. Or all saves, or none of them goes to the database On Mon, Jul 11, 2011 at 10:11 PM, Hassan Schroeder < hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Mon, Jul 11, 2011 at 5:55 PM, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > Problem is I want more than one model as I explained before. > > So each "step" is a different page, different model -- again, what is > the issue? Complete one, go to the next. > > -- > Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > http://about.me/hassanschroeder > twitter: @hassan > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Rodrigo Ruiz
2011-Jul-12 04:13 UTC
Re: Re: Help filling out a registration (I think it''s called multi tenant)
It uses a method called ''build'', which says (to me at least) that it doesn''t exist. On Mon, Jul 11, 2011 at 10:15 PM, Everaldo Gomes <everaldo.gomes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> Take a look in these screencasts: > > http://railscasts.com/episodes?utf8=%E2%9C%93&search=model > http://railscasts.com/episodes/196-nested-model-form-part-1 > http://railscasts.com/episodes/197-nested-model-form-part-2 > > Maybe they can help you. > > Best regards, > > Everaldo > > > On Mon, Jul 11, 2011 at 10:11 PM, Hassan Schroeder < > hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> On Mon, Jul 11, 2011 at 5:55 PM, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> wrote: >> > Problem is I want more than one model as I explained before. >> >> So each "step" is a different page, different model -- again, what is >> the issue? Complete one, go to the next. >> >> -- >> Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >> http://about.me/hassanschroeder >> twitter: @hassan >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
your input format is DD/MM/YYYY. change this to MM/DD/YYYY. On Tue, Jul 12, 2011 at 6:45 AM, Leigh Daniels <leighdaniels42-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> Hi All, > > When I enter a Start Date in the text field as "07/11/2011" it gets stored > in the database as "2011-11-07" instead of "2011-07-11". > > This change happens before the column is available in the controller. Is > there some Rails setting that will make this happen magically or do I have > to have some fun with date parsing? > > Thanks! > > **Leigh > > --------------------- > > [_form.html.erb] > <%= f.label :start_date, :class => ''label'' %><br /> > <%= f.text_field :start_date, :size => 15 %> > > [jobs_controller.rb] > def new > @job = Job.new > @job.rate = 125 > > respond_to do |format| > format.html # new.html.erb > format.json { render json: @job } > end > end > > [schema.rb] > t.date "start_date" > > > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 12 July 2011 07:11, Sayuj Othayoth <sayujothayoth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Tue, Jul 12, 2011 at 6:45 AM, Leigh Daniels <leighdaniels42-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: >> When I enter a Start Date in the text field as "07/11/2011" it gets stored >> in the database as "2011-11-07" instead of "2011-07-11". > > your input format is DD/MM/YYYY. change this to MM/DD/YYYY.Or better yet, "11 July 2011" - this makes it unambiguous. If you''re expecting users to type in dates in a certain format without making mistakes, you''re setting yourself up for lots of problems. I''d also suggest using a date-select JS plugin to make it very easy for your users to select the right date. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 12 July 2011 02:15, Leigh Daniels <leighdaniels42-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi All, > > When I enter a Start Date in the text field as "07/11/2011" it gets stored in the database as "2011-11-07" instead of "2011-07-11". > > This change happens before the column is available in the controller. Is there some Rails setting that will make this happen magically or do I have to have some fun with date parsing?If you want to allow the user to enter dates like this you will have to parse it yourself to make sure the month and day are as you want them. If the site is for an international audience I suggest you use separate fields for the three components as otherwise you will have no end of trouble as most of the world uses day/month/year. I don''t understand what you mean by "it happens before the column is available in the controller". The field will be passed as a string from the form to the controller and should appear in params exactly as entered by the user. Note also that, since you have specified a date field in the database, what is stored there is not "2011-07-11" or any other string, but is the date itself. Colin> > Thanks! > > **Leigh > > --------------------- > > [_form.html.erb] > <%= f.label :start_date, :class => ''label'' %><br /> > <%= f.text_field :start_date, :size => 15 %> > > [jobs_controller.rb] > def new > @job = Job.new > -YcChn/0O/OM@public.gmane.org = 125 > > respond_to do |format| > format.html # new.html.erb > format.json { render json: @job } > end > end > > [schema.rb] > t.date "start_date" > > > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Do you mean the user should type it in as MM/DD/YYYY or that there is a setting somewhere that I should change? **Leigh>your input format is DD/MM/YYYY. change this to MM/DD/YYYY. > >On Tue, Jul 12, 2011 at 6:45 AM, Leigh Daniels ><leighdaniels42-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: > >> Hi All, >> >> When I enter a Start Date in the text field as "07/11/2011" it gets stored >> in the database as "2011-11-07" instead of "2011-07-11". >> >> This change happens before the column is available in the controller. Is >> there some Rails setting that will make this happen magically or do I have >> to have some fun with date parsing? >> >> Thanks! >> >> **Leigh-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Leigh, It seems it takes the input as DD/MM/YYYY by default. that you need to change to your convenient format. Or ask the user to input the date in DD/MM/YYYY format which is default/current. On Tue, Jul 12, 2011 at 4:15 PM, Leigh Daniels <leighdaniels42-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> Do you mean the user should type it in as MM/DD/YYYY or that there is a > setting somewhere that I should change? > > **Leigh > > >your input format is DD/MM/YYYY. change this to MM/DD/YYYY. > > > >On Tue, Jul 12, 2011 at 6:45 AM, Leigh Daniels > ><leighdaniels42-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: > > > >> Hi All, > >> > >> When I enter a Start Date in the text field as "07/11/2011" it gets > stored > >> in the database as "2011-11-07" instead of "2011-07-11". > >> > >> This change happens before the column is available in the controller. Is > >> there some Rails setting that will make this happen magically or do I > have > >> to have some fun with date parsing? > >> > >> Thanks! > >> > >> **Leigh > > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Everaldo Gomes
2011-Jul-12 12:22 UTC
Re: Re: Help filling out a registration (I think it''s called multi tenant)
I don''t know if this is because Ryan Bates used nifty-generators to scaffold.... Try to follow the tutorial step by step, or download the source code of the episode. Best Regards, Everaldo On Tue, Jul 12, 2011 at 1:13 AM, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> It uses a method called ''build'', which says (to me at least) that it > doesn''t exist. > > On Mon, Jul 11, 2011 at 10:15 PM, Everaldo Gomes <everaldo.gomes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > wrote: > >> Take a look in these screencasts: >> >> http://railscasts.com/episodes?utf8=%E2%9C%93&search=model >> http://railscasts.com/episodes/196-nested-model-form-part-1 >> http://railscasts.com/episodes/197-nested-model-form-part-2 >> >> Maybe they can help you. >> >> Best regards, >> >> Everaldo >> >> >> On Mon, Jul 11, 2011 at 10:11 PM, Hassan Schroeder < >> hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>> On Mon, Jul 11, 2011 at 5:55 PM, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >>> wrote: >>> > Problem is I want more than one model as I explained before. >>> >>> So each "step" is a different page, different model -- again, what is >>> the issue? Complete one, go to the next. >>> >>> -- >>> Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >>> http://about.me/hassanschroeder >>> twitter: @hassan >>> >>> -- >>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To unsubscribe from this group, send email to >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2011-Jul-12 13:15 UTC
Re: Re: Help filling out a registration (I think it''s called multi tenant)
On 12 July 2011 05:13, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> It uses a method called ''build'', which says (to me at least) that it doesn''t > exist.Show us the exact error and the code around the failing line. Colin> > On Mon, Jul 11, 2011 at 10:15 PM, Everaldo Gomes <everaldo.gomes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: >> >> Take a look in these screencasts: >> http://railscasts.com/episodes?utf8=%E2%9C%93&search=model >> http://railscasts.com/episodes/196-nested-model-form-part-1 >> http://railscasts.com/episodes/197-nested-model-form-part-2 >> Maybe they can help you. >> Best regards, >> Everaldo >> >> On Mon, Jul 11, 2011 at 10:11 PM, Hassan Schroeder >> <hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> >>> On Mon, Jul 11, 2011 at 5:55 PM, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >>> wrote: >>> > Problem is I want more than one model as I explained before. >>> >>> So each "step" is a different page, different model -- again, what is >>> the issue? Complete one, go to the next. >>> >>> -- >>> Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >>> http://about.me/hassanschroeder >>> twitter: @hassan >>> >>> -- >>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To unsubscribe from this group, send email to >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Rodrigo Ruiz
2011-Jul-12 14:32 UTC
Re: Re: Help filling out a registration (I think it''s called multi tenant)
Actually what I''m looking for is a mix of the multistep form of 217 episode, with a different (and related) model (like 192) for each step, and want them to be saved at same time. On Tue, Jul 12, 2011 at 9:22 AM, Everaldo Gomes <everaldo.gomes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> I don''t know if this is because Ryan Bates used nifty-generators to > scaffold.... > > Try to follow the tutorial step by step, or download the source code of the > episode. > > Best Regards, > > Everaldo > > On Tue, Jul 12, 2011 at 1:13 AM, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: > >> It uses a method called ''build'', which says (to me at least) that it >> doesn''t exist. >> >> On Mon, Jul 11, 2011 at 10:15 PM, Everaldo Gomes < >> everaldo.gomes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>> Take a look in these screencasts: >>> >>> http://railscasts.com/episodes?utf8=%E2%9C%93&search=model >>> http://railscasts.com/episodes/196-nested-model-form-part-1 >>> http://railscasts.com/episodes/197-nested-model-form-part-2 >>> >>> Maybe they can help you. >>> >>> Best regards, >>> >>> Everaldo >>> >>> >>> On Mon, Jul 11, 2011 at 10:11 PM, Hassan Schroeder < >>> hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> >>>> On Mon, Jul 11, 2011 at 5:55 PM, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >>>> wrote: >>>> > Problem is I want more than one model as I explained before. >>>> >>>> So each "step" is a different page, different model -- again, what is >>>> the issue? Complete one, go to the next. >>>> >>>> -- >>>> Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >>>> http://about.me/hassanschroeder >>>> twitter: @hassan >>>> >>>> -- >>>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>> To unsubscribe from this group, send email to >>>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To unsubscribe from this group, send email to >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2011-Jul-12 14:40 UTC
Re: Re: Help filling out a registration (I think it''s called multi tenant)
On 12 July 2011 15:32, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Actually what I''m looking for is a mix of the multistep form of 217 episode, > with a different (and related) model (like 192) for each step, and want them > to be saved at same time.I have not looked at that episode (217) recently, but I believe it is building up the data over several steps (in the session) and then saving it at the end. You can use the same technique but at the end save it to your multiple models instead of the single one. Colin> > On Tue, Jul 12, 2011 at 9:22 AM, Everaldo Gomes <everaldo.gomes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: >> >> I don''t know if this is because Ryan Bates used nifty-generators to >> scaffold.... >> >> Try to follow the tutorial step by step, or download the source code of >> the episode. >> >> Best Regards, >> >> Everaldo >> >> On Tue, Jul 12, 2011 at 1:13 AM, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> wrote: >>> >>> It uses a method called ''build'', which says (to me at least) that it >>> doesn''t exist. >>> >>> On Mon, Jul 11, 2011 at 10:15 PM, Everaldo Gomes >>> <everaldo.gomes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>>> >>>> Take a look in these screencasts: >>>> http://railscasts.com/episodes?utf8=%E2%9C%93&search=model >>>> http://railscasts.com/episodes/196-nested-model-form-part-1 >>>> http://railscasts.com/episodes/197-nested-model-form-part-2 >>>> Maybe they can help you. >>>> Best regards, >>>> Everaldo >>>> >>>> On Mon, Jul 11, 2011 at 10:11 PM, Hassan Schroeder >>>> <hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>>>> >>>>> On Mon, Jul 11, 2011 at 5:55 PM, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8@public.gmane.orgm> >>>>> wrote: >>>>> > Problem is I want more than one model as I explained before. >>>>> >>>>> So each "step" is a different page, different model -- again, what is >>>>> the issue? Complete one, go to the next. >>>>> >>>>> -- >>>>> Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >>>>> http://about.me/hassanschroeder >>>>> twitter: @hassan >>>>> >>>>> -- >>>>> 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-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.orgm. >>>>> To unsubscribe from this group, send email to >>>>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>>> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org. >>>> To unsubscribe from this group, send email to >>>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To unsubscribe from this group, send email to >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Rodrigo Ruiz
2011-Jul-12 14:54 UTC
Re: Re: Help filling out a registration (I think it''s called multi tenant)
If I do the same as the 196 episode it works, but I want a has_one and belongs_to relationship, no has_many. With has_one it doesn''t work. If I set all to singular form (the names of model I mean) I get this error: NoMethodError in CompaniesController#new undefined method `build'' for nil:NilClass I got company and company_contact models Company model: has_one :company_contact, :dependent => :destroy accepts_nested_attributes_for :company_contact CompaniesController: def new @company = Company.new @company.company_contact.build end CompanyContact model: belongs_to :company views/companies/new: <% f.fields_for :company_contact do |company_contact_form| %> <div class=''field''> <%= company_contact_form.label ''Nome do responsável por Marketing'' %> <%= company_contact_form.text_field :marketing_name %> </div> <% end %> On Tue, Jul 12, 2011 at 10:15 AM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 12 July 2011 05:13, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > It uses a method called ''build'', which says (to me at least) that it > doesn''t > > exist. > > Show us the exact error and the code around the failing line. > > Colin > > > > > On Mon, Jul 11, 2011 at 10:15 PM, Everaldo Gomes < > everaldo.gomes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > wrote: > >> > >> Take a look in these screencasts: > >> http://railscasts.com/episodes?utf8=%E2%9C%93&search=model > >> http://railscasts.com/episodes/196-nested-model-form-part-1 > >> http://railscasts.com/episodes/197-nested-model-form-part-2 > >> Maybe they can help you. > >> Best regards, > >> Everaldo > >> > >> On Mon, Jul 11, 2011 at 10:11 PM, Hassan Schroeder > >> <hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >>> > >>> On Mon, Jul 11, 2011 at 5:55 PM, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8@public.gmane.orgm > > > >>> wrote: > >>> > Problem is I want more than one model as I explained before. > >>> > >>> So each "step" is a different page, different model -- again, what is > >>> the issue? Complete one, go to the next. > >>> > >>> -- > >>> Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > >>> http://about.me/hassanschroeder > >>> twitter: @hassan > >>> > >>> -- > >>> 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-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.orgm > . > >>> To unsubscribe from this group, send email to > >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >>> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org. > >> To unsubscribe from this group, send email to > >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Colin Law
2011-Jul-12 15:15 UTC
Re: Re: Help filling out a registration (I think it''s called multi tenant)
On 12 July 2011 15:54, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: Could you not top post please, it makes it difficult to follow the thread. Insert your comments at appropriate points in previous message. Thanks.> If I do the same as the 196 episode it works, but I want a has_one and > belongs_to relationship, no has_many. > With has_one it doesn''t work. If I set all to singular form (the names of > model I mean) I get this error: > > NoMethodError in CompaniesController#new > > undefined method `build'' for nil:NilClass > > I got company and company_contact models > Company model: > has_one :company_contact, :dependent => :destroy > accepts_nested_attributes_for :company_contact > CompaniesController: > def new > @company = Company.new > -//Bz/+gSJx1wkoGAtB9Kcg@public.gmane.org_contact.buildI have not done this but looking at the docs [1], for a has_one relationship I think you need to do @company.build_company_contact Colin [1] http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html> end > CompanyContact model: > belongs_to :company > views/companies/new: > <% f.fields_for :company_contact do |company_contact_form| %> > <div class=''field''> > <%= company_contact_form.label ''Nome do responsável por Marketing'' %> > <%= company_contact_form.text_field :marketing_name %> > </div> > <% end %> > > > On Tue, Jul 12, 2011 at 10:15 AM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> >> On 12 July 2011 05:13, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > It uses a method called ''build'', which says (to me at least) that it >> > doesn''t >> > exist. >> >> Show us the exact error and the code around the failing line. >> >> Colin >> >> > >> > On Mon, Jul 11, 2011 at 10:15 PM, Everaldo Gomes >> > <everaldo.gomes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> > wrote: >> >> >> >> Take a look in these screencasts: >> >> http://railscasts.com/episodes?utf8=%E2%9C%93&search=model >> >> http://railscasts.com/episodes/196-nested-model-form-part-1 >> >> http://railscasts.com/episodes/197-nested-model-form-part-2 >> >> Maybe they can help you. >> >> Best regards, >> >> Everaldo >> >> >> >> On Mon, Jul 11, 2011 at 10:11 PM, Hassan Schroeder >> >> <hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>> >> >>> On Mon, Jul 11, 2011 at 5:55 PM, Rodrigo Ruiz >> >>> <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> >>> wrote: >> >>> > Problem is I want more than one model as I explained before. >> >>> >> >>> So each "step" is a different page, different model -- again, what is >> >>> the issue? Complete one, go to the next. >> >>> >> >>> -- >> >>> Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >> >>> http://about.me/hassanschroeder >> >>> twitter: @hassan >> >>> >> >>> -- >> >>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> >>> To unsubscribe from this group, send email to >> >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> >>> 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 rubyonrails-talk-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.orgm. >> >> To unsubscribe from this group, send email to >> >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> >> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org. >> > To unsubscribe from this group, send email to >> > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Rodrigo Ruiz
2011-Jul-12 15:31 UTC
Re: Re: Help filling out a registration (I think it''s called multi tenant)
Sorry, I don''t know exactly what top posting is, but I''m replying the last email always, if that''s what you mean On Tue, Jul 12, 2011 at 12:15 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 12 July 2011 15:54, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Could you not top post please, it makes it difficult to follow the > thread. Insert your comments at appropriate points in previous > message. Thanks. > > > If I do the same as the 196 episode it works, but I want a has_one and > > belongs_to relationship, no has_many. > > With has_one it doesn''t work. If I set all to singular form (the names of > > model I mean) I get this error: > > > > NoMethodError in CompaniesController#new > > > > undefined method `build'' for nil:NilClass > > > > I got company and company_contact models > > Company model: > > has_one :company_contact, :dependent => :destroy > > accepts_nested_attributes_for :company_contact > > CompaniesController: > > def new > > @company = Company.new > > @company.company_contact.build > > I have not done this but looking at the docs [1], for a has_one > relationship I think you need to do > @company.build_company_contact > > Colin > > [1] > http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html > > > end > > CompanyContact model: > > belongs_to :company > > views/companies/new: > > <% f.fields_for :company_contact do |company_contact_form| %> > > <div class=''field''> > > <%= company_contact_form.label ''Nome do responsável por Marketing'' %> > > <%= company_contact_form.text_field :marketing_name %> > > </div> > > <% end %> > > > > > > On Tue, Jul 12, 2011 at 10:15 AM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > wrote: > >> > >> On 12 July 2011 05:13, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> > It uses a method called ''build'', which says (to me at least) that it > >> > doesn''t > >> > exist. > >> > >> Show us the exact error and the code around the failing line. > >> > >> Colin > >> > >> > > >> > On Mon, Jul 11, 2011 at 10:15 PM, Everaldo Gomes > >> > <everaldo.gomes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > >> > wrote: > >> >> > >> >> Take a look in these screencasts: > >> >> http://railscasts.com/episodes?utf8=%E2%9C%93&search=model > >> >> http://railscasts.com/episodes/196-nested-model-form-part-1 > >> >> http://railscasts.com/episodes/197-nested-model-form-part-2 > >> >> Maybe they can help you. > >> >> Best regards, > >> >> Everaldo > >> >> > >> >> On Mon, Jul 11, 2011 at 10:11 PM, Hassan Schroeder > >> >> <hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> >>> > >> >>> On Mon, Jul 11, 2011 at 5:55 PM, Rodrigo Ruiz > >> >>> <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > >> >>> wrote: > >> >>> > Problem is I want more than one model as I explained before. > >> >>> > >> >>> So each "step" is a different page, different model -- again, what > is > >> >>> the issue? Complete one, go to the next. > >> >>> > >> >>> -- > >> >>> Hassan Schroeder ------------------------ > hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > >> >>> http://about.me/hassanschroeder > >> >>> twitter: @hassan > >> >>> > >> >>> -- > >> >>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> >>> To unsubscribe from this group, send email to > >> >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> >>> 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 > rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> >> To unsubscribe from this group, send email to > >> >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> >> 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 > rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> > To unsubscribe from this group, send email to > >> > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org. > >> To unsubscribe from this group, send email to > >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Rodrigo Ruiz
2011-Jul-12 15:32 UTC
Re: Re: Help filling out a registration (I think it''s called multi tenant)
And no, it doesn''t work =/ On Tue, Jul 12, 2011 at 12:15 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 12 July 2011 15:54, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Could you not top post please, it makes it difficult to follow the > thread. Insert your comments at appropriate points in previous > message. Thanks. > > > If I do the same as the 196 episode it works, but I want a has_one and > > belongs_to relationship, no has_many. > > With has_one it doesn''t work. If I set all to singular form (the names of > > model I mean) I get this error: > > > > NoMethodError in CompaniesController#new > > > > undefined method `build'' for nil:NilClass > > > > I got company and company_contact models > > Company model: > > has_one :company_contact, :dependent => :destroy > > accepts_nested_attributes_for :company_contact > > CompaniesController: > > def new > > @company = Company.new > > @company.company_contact.build > > I have not done this but looking at the docs [1], for a has_one > relationship I think you need to do > @company.build_company_contact > > Colin > > [1] > http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html > > > end > > CompanyContact model: > > belongs_to :company > > views/companies/new: > > <% f.fields_for :company_contact do |company_contact_form| %> > > <div class=''field''> > > <%= company_contact_form.label ''Nome do responsável por Marketing'' %> > > <%= company_contact_form.text_field :marketing_name %> > > </div> > > <% end %> > > > > > > On Tue, Jul 12, 2011 at 10:15 AM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > wrote: > >> > >> On 12 July 2011 05:13, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> > It uses a method called ''build'', which says (to me at least) that it > >> > doesn''t > >> > exist. > >> > >> Show us the exact error and the code around the failing line. > >> > >> Colin > >> > >> > > >> > On Mon, Jul 11, 2011 at 10:15 PM, Everaldo Gomes > >> > <everaldo.gomes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > >> > wrote: > >> >> > >> >> Take a look in these screencasts: > >> >> http://railscasts.com/episodes?utf8=%E2%9C%93&search=model > >> >> http://railscasts.com/episodes/196-nested-model-form-part-1 > >> >> http://railscasts.com/episodes/197-nested-model-form-part-2 > >> >> Maybe they can help you. > >> >> Best regards, > >> >> Everaldo > >> >> > >> >> On Mon, Jul 11, 2011 at 10:11 PM, Hassan Schroeder > >> >> <hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> >>> > >> >>> On Mon, Jul 11, 2011 at 5:55 PM, Rodrigo Ruiz > >> >>> <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > >> >>> wrote: > >> >>> > Problem is I want more than one model as I explained before. > >> >>> > >> >>> So each "step" is a different page, different model -- again, what > is > >> >>> the issue? Complete one, go to the next. > >> >>> > >> >>> -- > >> >>> Hassan Schroeder ------------------------ > hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > >> >>> http://about.me/hassanschroeder > >> >>> twitter: @hassan > >> >>> > >> >>> -- > >> >>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> >>> To unsubscribe from this group, send email to > >> >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> >>> 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 > rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> >> To unsubscribe from this group, send email to > >> >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> >> 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 > rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> > To unsubscribe from this group, send email to > >> > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org. > >> To unsubscribe from this group, send email to > >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Angel Robert Marquez
2011-Jul-12 15:36 UTC
Re: Re: Help filling out a registration (I think it''s called multi tenant)
save each page form values as session variables and only perform the insert to multiple tables on the final page, right? On Tue, Jul 12, 2011 at 8:32 AM, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> And no, it doesn''t work =/ > > > On Tue, Jul 12, 2011 at 12:15 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>wrote: > >> On 12 July 2011 15:54, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> Could you not top post please, it makes it difficult to follow the >> thread. Insert your comments at appropriate points in previous >> message. Thanks. >> >> > If I do the same as the 196 episode it works, but I want a has_one and >> > belongs_to relationship, no has_many. >> > With has_one it doesn''t work. If I set all to singular form (the names >> of >> > model I mean) I get this error: >> > >> > NoMethodError in CompaniesController#new >> > >> > undefined method `build'' for nil:NilClass >> > >> > I got company and company_contact models >> > Company model: >> > has_one :company_contact, :dependent => :destroy >> > accepts_nested_attributes_for :company_contact >> > CompaniesController: >> > def new >> > @company = Company.new >> > @company.company_contact.build >> >> I have not done this but looking at the docs [1], for a has_one >> relationship I think you need to do >> @company.build_company_contact >> >> Colin >> >> [1] >> http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html >> >> > end >> > CompanyContact model: >> > belongs_to :company >> > views/companies/new: >> > <% f.fields_for :company_contact do |company_contact_form| %> >> > <div class=''field''> >> > <%= company_contact_form.label ''Nome do responsável por Marketing'' %> >> > <%= company_contact_form.text_field :marketing_name %> >> > </div> >> > <% end %> >> > >> > >> > On Tue, Jul 12, 2011 at 10:15 AM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> >> wrote: >> >> >> >> On 12 July 2011 05:13, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> > It uses a method called ''build'', which says (to me at least) that it >> >> > doesn''t >> >> > exist. >> >> >> >> Show us the exact error and the code around the failing line. >> >> >> >> Colin >> >> >> >> > >> >> > On Mon, Jul 11, 2011 at 10:15 PM, Everaldo Gomes >> >> > <everaldo.gomes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> >> > wrote: >> >> >> >> >> >> Take a look in these screencasts: >> >> >> http://railscasts.com/episodes?utf8=%E2%9C%93&search=model >> >> >> http://railscasts.com/episodes/196-nested-model-form-part-1 >> >> >> http://railscasts.com/episodes/197-nested-model-form-part-2 >> >> >> Maybe they can help you. >> >> >> Best regards, >> >> >> Everaldo >> >> >> >> >> >> On Mon, Jul 11, 2011 at 10:11 PM, Hassan Schroeder >> >> >> <hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> >>> >> >> >>> On Mon, Jul 11, 2011 at 5:55 PM, Rodrigo Ruiz >> >> >>> <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> >> >>> wrote: >> >> >>> > Problem is I want more than one model as I explained before. >> >> >>> >> >> >>> So each "step" is a different page, different model -- again, what >> is >> >> >>> the issue? Complete one, go to the next. >> >> >>> >> >> >>> -- >> >> >>> Hassan Schroeder ------------------------ >> hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >> >> >>> http://about.me/hassanschroeder >> >> >>> twitter: @hassan >> >> >>> >> >> >>> -- >> >> >>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> >> >>> To unsubscribe from this group, send email to >> >> >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> >> >>> 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 >> rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> >> >> To unsubscribe from this group, send email to >> >> >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> >> >> 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 >> rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> >> > To unsubscribe from this group, send email to >> >> > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> >> > 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 rubyonrails-talk-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.orgm >> . >> >> To unsubscribe from this group, send email to >> >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> >> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org. >> > To unsubscribe from this group, send email to >> > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Hi Colin, Sayuj and Michael, This is a proprietary, in-house app in Rails 3.1rc4 for the U.S market and they hate date_select ("Date is a little hard to fill out. It is time-consuming to click on "January" and scroll to "June", etc. Any chance I could type in 6/3/11?").>If you want to allow the user to enter dates like this you will have >to parse it yourself to make sure the month and day are as you want >them. If the site is for an international audience I suggest you use >separate fields for the three components as otherwise you will have no >end of trouble as most of the world uses day/month/year. I don''t >understand what you mean by "it happens before the column is available >in the controller". The field will be passed as a string from the >form to the controller and should appear in params exactly as entered >by the user. Note also that, since you have specified a date field in >the database, what is stored there is not "2011-07-11" or any other >string, but is the date itself.Colin, you are right that params[:start_date] is exactly as entered in the form. What I ended up doing was handling it in the controller with: [JobsController] def create @job = Job.new(params[:job]) @job.start_date = parse_free_date(params[:job][:start_date]) @job.due_date = parse_free_date(params[:job][:due_date]) and private def parse_free_date(date_str) case date_str when /\A(\d|\d\d)\/(\d|\d\d)\/(\d\d)\z/ # "6/3/11" or "06/03/11" parts = date_str.split(''/'', 3) "20#{parts[2]}-#{parts[0]}-#{parts[1]}" when /\A\d{4}-\d{2}-\d{2}\z/ # "2011-07-11" date_str when /\A(\d|\d\d)\/(\d|\d\d)\/(\d\d\d\d)\z/ # "6/3/2011" or "06/03/2011" parts = date_str.split(''/'', 3) "#{parts[2]}-#{parts[0]}-#{parts[1]}" when /\A(\d|\d\d)-(\d|\d\d)-(\d\d\d\d)\z/ # "6-3-2011" or "06-03-2011" parts = date_str.split(''/'', 3) "#{parts[2]}-#{parts[0]}-#{parts[1]}" end end I''ll tighten up the regexes later; they are good enough for a prototype. Thanks for all your help! **Leigh -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2011-Jul-12 19:38 UTC
Re: Re: Help filling out a registration (I think it''s called multi tenant)
On 12 July 2011 16:31, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Sorry, I don''t know exactly what top posting is, but I''m replying the last > email always, if that''s what you meanTop posting is putting your reply above the previous message, as you have done, as opposed to inserting your reply at appropriate points in the previous message as I am doing here.> > On Tue, Jul 12, 2011 at 12:15 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> >> On 12 July 2011 15:54, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> Could you not top post please, it makes it difficult to follow the >> thread. Insert your comments at appropriate points in previous >> message. Thanks.I tried to make my suggestion clear, but apparently I failed. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Colin Law
2011-Jul-12 19:40 UTC
Re: Re: Help filling out a registration (I think it''s called multi tenant)
On 12 July 2011 16:32, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> And no, it doesn''t work =/It is no good just saying it doesn''t work, what hope has anyone here got of helping further if that is all the information you give? Show us the modified code and the new error message you are getting. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 12 July 2011 19:13, Leigh Daniels <leighdaniels42-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Colin, Sayuj and Michael, > > This is a proprietary, in-house app in Rails 3.1rc4 for the U.S market and they hate date_select ("Date is a little hard to fill out. It is time-consuming to click on "January" and scroll to "June", etc. Any chance I could type in 6/3/11?"). > >>If you want to allow the user to enter dates like this you will have >>to parse it yourself to make sure the month and day are as you want >>them. If the site is for an international audience I suggest you use >>separate fields for the three components as otherwise you will have no >>end of trouble as most of the world uses day/month/year. I don''t >>understand what you mean by "it happens before the column is available >>in the controller". The field will be passed as a string from the >>form to the controller and should appear in params exactly as entered >>by the user. Note also that, since you have specified a date field in >>the database, what is stored there is not "2011-07-11" or any other >>string, but is the date itself. > > Colin, you are right that params[:start_date] is exactly as entered in the form. > > What I ended up doing was handling it in the controller with: > [JobsController] > def create > @job = Job.new(params[:job]) > -wxwk6a6YdvJeoWH0uzbU5w@public.gmane.org_date = parse_free_date(params[:job][:start_date])Something like Date.strptime( params[:job][:start_date], "%Y/%m/%d" ) [ untested ] should do what you want. Don''t forget to catch the exception in the case of a parse error. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
On Tue, Jul 12, 2011, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:>On 12 July 2011 19:13, Leigh Daniels <leighdaniels42-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> Hi Colin, Sayuj and Michael, >> >> This is a proprietary, in-house app in Rails 3.1rc4 for the U.S market >and they hate date_select ("Date is a little hard to fill out. It is >time-consuming to click on "January" and scroll to "June", etc. Any >chance I could type in 6/3/11?"). >> >>>If you want to allow the user to enter dates like this you will have >>>to parse it yourself to make sure the month and day are as you want >>>them. If the site is for an international audience I suggest you use >>>separate fields for the three components as otherwise you will have no >>>end of trouble as most of the world uses day/month/year. I don''t >>>understand what you mean by "it happens before the column is available >>>in the controller". The field will be passed as a string from the >>>form to the controller and should appear in params exactly as entered >>>by the user. Note also that, since you have specified a date field in >>>the database, what is stored there is not "2011-07-11" or any other >>>string, but is the date itself. >> >> Colin, you are right that params[:start_date] is exactly as entered in >the form. >> >> What I ended up doing was handling it in the controller with: >> [JobsController] >> def create >> @job = Job.new(params[:job]) >> -wxwk6a6YdvJeoWH0uzbU5w@public.gmane.org_date = parse_free_date(params[:job][:start_date]) > >Something like >Date.strptime( params[:job][:start_date], "%Y/%m/%d" ) [ untested ] >should do what you want. Don''t forget to catch the exception in the >case of a parse error. >Thanks for the exception reminder!>Colin-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
On 12 July 2011 20:58, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 12 July 2011 19:13, Leigh Daniels <leighdaniels42-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> Hi Colin, Sayuj and Michael, >> >> This is a proprietary, in-house app in Rails 3.1rc4 for the U.S market and they hate date_select ("Date is a little hard to fill out. It is time-consuming to click on "January" and scroll to "June", etc. Any chance I could type in 6/3/11?"). >> >>>If you want to allow the user to enter dates like this you will have >>>to parse it yourself to make sure the month and day are as you want >>>them. If the site is for an international audience I suggest you use >>>separate fields for the three components as otherwise you will have no >>>end of trouble as most of the world uses day/month/year. I don''t >>>understand what you mean by "it happens before the column is available >>>in the controller". The field will be passed as a string from the >>>form to the controller and should appear in params exactly as entered >>>by the user. Note also that, since you have specified a date field in >>>the database, what is stored there is not "2011-07-11" or any other >>>string, but is the date itself. >> >> Colin, you are right that params[:start_date] is exactly as entered in the form. >> >> What I ended up doing was handling it in the controller with: >> [JobsController] >> def create >> @job = Job.new(params[:job]) >> -wxwk6a6YdvJeoWH0uzbU5w@public.gmane.org_date = parse_free_date(params[:job][:start_date]) > > Something like > Date.strptime( params[:job][:start_date], "%Y/%m/%d" ) [ untested ]I meant "%m/%d/%Y" of course (I said it was untested, it still is.) Colin> should do what you want. Don''t forget to catch the exception in the > case of a parse error. > > Colin >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Rodrigo Ruiz
2011-Jul-12 20:47 UTC
Re: Re: Help filling out a registration (I think it''s called multi tenant)
views/companies: <% f.fields_for :company_contact do |company_contact_form| %> <div class=''field''> <%= company_contact_form.label ''Name of the responsible for marketing'' %> <%= company_contact_form.text_field :marketing_name %> </div> <% end %> CompaniesController: def new @company = Company.new @company.build_company_contact end Company model: has_one :company_contact, :dependent => :destroy accepts_nested_attributes_for :company_contact This code doesn''t crash or show any error, but it just doesn''t show the CompanyContact information at the form. On Tue, Jul 12, 2011 at 4:40 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 12 July 2011 16:32, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > And no, it doesn''t work =/ > > It is no good just saying it doesn''t work, what hope has anyone here > got of helping further if that is all the information you give? Show > us the modified code and the new error message you are getting. > > Colin > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Rodrigo Ruiz
2011-Jul-12 20:48 UTC
Re: Re: Help filling out a registration (I think it''s called multi tenant)
BTW, sorry for top posting again =/. I just remembered when I had already sent that last email -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2011-Jul-12 20:58 UTC
Re: Re: Help filling out a registration (I think it''s called multi tenant)
On 12 July 2011 21:47, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> views/companies: > <% f.fields_for :company_contact do |company_contact_form| %> > <div class=''field''> > <%= company_contact_form.label ''Name of the responsible for marketing'' %> > <%= company_contact_form.text_field :marketing_name %> > </div> > <% end %> > CompaniesController: > def new > @company = Company.new > -//Bz/+gSJx2ej5ctfdv7WQ@public.gmane.org_company_contact > end > Company model: > has_one :company_contact, :dependent => :destroy > accepts_nested_attributes_for :company_contact > > This code doesn''t crash or show any error, but it just doesn''t show the > CompanyContact information at the form.So it probably has worked then. Now you have a different problem you need to investigate. Have a look at the Rails Guide on debugging to get ideas on how to proceed. Using ruby-debug to break into your code and inspect data and follow the flow is particularly useful. Colin> > On Tue, Jul 12, 2011 at 4:40 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> >> On 12 July 2011 16:32, Rodrigo Ruiz <rodrigo.ruiz7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > And no, it doesn''t work =/ >> >> It is no good just saying it doesn''t work, what hope has anyone here >> got of helping further if that is all the information you give? Show >> us the modified code and the new error message you are getting. >> >> Colin >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Rodrigo Ruiz
2011-Jul-12 22:02 UTC
Re: Re: Help filling out a registration (I think it''s called multi tenant)
http://apidock.com/rails/ActionView/Helpers/FormHelper/fields_for That explains exactly what I did, the one-to-one part, and still nothing -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Rodrigo Ruiz
2011-Jul-12 22:43 UTC
Re: Re: Help filling out a registration (I think it''s called multi tenant)
I did it =), thank you everyone, the problem was that I was writing: <% f.fields_for :company_contact do |company_contact_form| %> instead of: <%= f.fields_for :company_contact do |company_contact_form| %> Thank you very much, Now I just need help to make this into a multi step form. If anyone have any ideas I appreciate it. Thank you again, Rodrigo -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
paul h
2011-Jul-13 14:13 UTC
Re: Help filling out a registration (I think it''s called multi tenant)
On Jul 12, 11:43 pm, Rodrigo Ruiz <rodrigo.ru...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I did it =), thank you everyone, the problem was that I was writing: > <% f.fields_for :company_contact do |company_contact_form| %> > instead of: > <%= f.fields_for :company_contact do |company_contact_form| %> > > Thank you very much, > Now I just need help to make this into a multi step form. If anyone have any > ideas I appreciate it.Hi Rodrigo, I have uploaded a demo to github: https://github.com/phollyer/Very-simple-multi-step--multi-model-form This should give you a place to start. As the title says, it is VERY SIMPLE. There is no error handling, I leave that as an excercise for you, or for anyone else that finds it useful. I would seriously suggest though, if I may, that you should do some reading - the latest AWDwR book, and the latest Ruby Pickaxe book, both from PragProg wouldn''t be a bad place to start. Otherwise, you are going to find yourself continually asking questions. When you have cloned the repo, just do the following to get it up and running: bundle install rake db:migrate That should be all you need, now you can run the cuke features to test, or start the server and try it in your browser. HTH Paul> > Thank you again, > Rodrigo-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Hi Colin, On Tue, Jul 12, 2011, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:>On 12 July 2011 19:13, Leigh Daniels <leighdaniels42-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> Hi Colin, Sayuj and Michael, >> >> This is a proprietary, in-house app in Rails 3.1rc4 for the U.S market >and they hate date_select ("Date is a little hard to fill out. It is >time-consuming to click on "January" and scroll to "June", etc. Any >chance I could type in 6/3/11?"). >> >>>If you want to allow the user to enter dates like this you will have >>>to parse it yourself to make sure the month and day are as you want >>>them. If the site is for an international audience I suggest you use >>>separate fields for the three components as otherwise you will have no >>>end of trouble as most of the world uses day/month/year. I don''t >>>understand what you mean by "it happens before the column is available >>>in the controller". The field will be passed as a string from the >>>form to the controller and should appear in params exactly as entered >>>by the user. Note also that, since you have specified a date field in >>>the database, what is stored there is not "2011-07-11" or any other >>>string, but is the date itself. >> >> Colin, you are right that params[:start_date] is exactly as entered in >the form. >> >> What I ended up doing was handling it in the controller with: >> [JobsController] >> def create >> @job = Job.new(params[:job]) >> -wxwk6a6YdvJeoWH0uzbU5w@public.gmane.org_date = parse_free_date(params[:job][:start_date]) > >Something like >Date.strptime( params[:job][:start_date], "%Y/%m/%d" ) [ untested ] >should do what you want. Don''t forget to catch the exception in the >case of a parse error. >I refactored it into a lib/utilities.rb module so the testing would be easier. That seemed like the cleanest approach. And once I added the exception handling, all the other app tests are now passing and the client is happy! Thanks. *Leigh -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.