Ruby on Rails
Friday, February 25, 2011
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-activerecordmultiparameterassignmenterrors-mean
On Sat, Feb 26, 2011 at 12:00 AM, Me <chabgood@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)end
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
Model method:
def self.create_type(params)
bad =[]
#begin=begin
@tour_type = TourType.new(params[:tour_type])if @tour_type.savereturn bad
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
=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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment