heartcombo/mail_form

Error when using a date attribute with date_select

robotex82 opened this issue · 6 comments

Hi,

I defined a class ApplicationRequest < MailFrom with an attribute :birthdate.

class ApplicationRequest < MailForm::Base
attribute :birthdate, :validate => true
.
.
.
end

In my views, I use a date_select helper:
<%= f.date_select :birthdate %>

When I submit the form I get following Exception:
NoMethodError in Application requestsController#create

undefined method `birthdate(1i)=' for #<ApplicationRequest:0xa43a1fc @firstname="", @lastname="">

Shouldn't mail form handle this form me? If not, how should I handle the date the right way?

Cheers,

Roberto

P.S.: Greeeeat gem, you've written there!

I think that mail_form don't deals with date_select fields. Try change this field to a text_field.

Thanks for the fast reply!

I've already thought about that. Unfortunately, this is no option (the customer wants select fields)

Any clues?

I think that don't have another way. A possible way is reimplement the attributes logic of ActiveRecord::Base on MailForm::Base, but I think that this is not the purpose of gem.

We have no support for dates. :( it could be easy if that stuff was in active model, but it isn't !

Ok, thanks! I'll then have to use a full-blown ActiveRecord model. I think, this is something, that rails should put in a module on it's own, so it can be integrated in resources like mail_form.

any chance to see it implemented anyway?