On Feb 26, 6:13 am, Bryan Crossland <bacrossl...@gmail.com> wrote:
> And I take it you are still getting the error? If that is the case, then
> change your view from using a datetime_select to using a date_select. You
> maybe encountering the problem discussed here:http://stackoverflow.com/questions/93277/what-does-activerecordmultip...
>
It would also be worth showing us what the params in the log look like
and what the corresponding database field types look like.
Fred
>
>
> On Sat, Feb 26, 2011 at 12:00 AM, Me <chabg...@gmail.com> wrote:
> > Ok, I have a custom call in my controller to call the model method:
>
> > Controller:
>
> > def create
> > bad = TourType.create_type(params)
>
> > unless bad.empty?
> > flash.now[:error] = "#{bad.length} Errors have occured in this form"
> > flash.now[:items] = bad
> > render :update do |page|
> > page[:flash].replace_html :partial => 'shared/flash_box'
> > end
> > end
> > end
>
> > Model method:
>
> > def self.create_type(params)
> > bad =[]
> > #begin
>
> > @tour_type = TourType.new(params[:tour_type])
> > =begin
> > if @tour_type.save
> > render :update do |page|
> > page << "Redbox.close;"
> > page.call "ProtoGrowl.success", "Succesfully created #{@
> > tour_type.name}"
> > end
> > end
> > rescue ActiveRecord::MultiparameterAssignmentErrors
> > if params[:tour_type][:usual_price_number].blank?
> > bad << "Usual price must not be 0.00"
> > end
>
> > rescue ActiveRecord::RecordInvalid
> > bad << "#{@tour_type.errors.full_messages}"
>
> > end
> > return bad
> > =end
> > end
>
> > On Friday, February 25, 2011 11:47:58 PM UTC-6, Me wrote:
>
> >> yes
>
> >> On Friday, February 25, 2011 11:46:27 PM UTC-6, bacrossland wrote:
>
> >>> On Fri, Feb 25, 2011 at 11:43 PM, Me <cha...@gmail.com> wrote:
>
> >>>> @tour_type = TourType.new(params[:tour_type])
>
> >>> That is in your TourType model on line 72?
>
> >> --
> > You received this message because you are subscribed to the Google Groups
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-talk@googlegroups.com.
> > To unsubscribe from this group, send email to
> > rubyonrails-talk+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/rubyonrails-talk?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.
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.
No comments:
Post a Comment