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 <[email protected]> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to