Are you able to reproduce it with tests or specs? Are the same  
versions of Ruby and Rails installed?

On a side note, you might consider reading up on skinny controllers,  
fat models.

Here are a few links..

http://www.robbyonrails.com/articles/2007/06/19/put-your-controllers- 
on-a-diet-already

Good luck!

Robby


On Jul 29, 2007, at 6:48 AM, Robert Lorimor wrote:

>
> The code below works in my development server on my home computer.
> However, the code breaks with a 'Internet minimum invalid' validation
> error when deploy to production server.
>
> What could the problem be? HOw might I track down what causing this?
>
> the code:
> ===================
> #In my shop controller
> def update
>   @mins = InternetMinimum.new
>   @shop.update_attributes( params[ :shop ] )
>   @line_of_sale =  @shop.line_of_sales.find( :first, :conditions =>
> 'type = "InternetRate"' ) ||
>     @line_of_sale =  InternetRate.new
>   @line_of_sale.update_attributes( params[ :line_of_sale ] )
>   @line_of_sale.name = 'Internet Rate' #  default if new or old, there
> is only one per shop
>   @shop.all_internet_minimums.each { |min| min.destroy }
>   if params[ :internet_minimums ]
>     params[ :internet_minimums ].each_value do |min |
>       @shop.internet_minimums.build(min) unless min.values.all?(
> &:blank? )
>     end
>   end
>   Shop.transaction do
>     @shop.save!
>     @line_of_sale.shop = @shop
>     @line_of_sale.save!
>     flash[ :notice ] = 'Shop was successfully updated.'
>     redirect_to :action => :index
>   end
> rescue ActiveRecord::RecordInvalid => e
>   @line_of_sale.valid?
>   @shop.valid?
>   render :action => :setup
> end
>
> #models
> class InternetMinimum < ActiveRecord::Base
>
>   belongs_to :shop
>
>   validates_presence_of :minutes, :min_charge, :message => "must be
> present"
>   validates_uniqueness_of :minutes, :message => "must be  
> unique", :scope
> => 'shop_id'
>   validates_numericality_of :minutes, :only_integer =>  
> true, :message =>
> "number only, no other characters allowed"
>   validates_numericality_of :min_charge, :message => 'must be a number
> (decimal is OK)'
>   validates_length_of :minutes, :maximum => 4
>
> end
>
> #Inside my view
>   <ol id="min_sets">
>   <% @shop.internet_minimums.each_with_index do |mins, index| %>
>     <%= render :partial => 'set_field', :locals => { :mins => mins,
> :index => index } %>
>   <% end %>
>   <% if @shop.internet_minimums.size == 0 %>
>     <%= render :partial => 'set_field', :locals => { :mins => @mins,
> :index => 0 } %>
>   <% end %>
>   </ol>
>   <%= render :partial => 'add_set_link', :locals => { :index =>
> @shop.internet_minimums.size + 1 } %>
>
> #partials
> #_set_field.rhtml
> <% fields_for "internet_minimums[#{index}]", mins do |ff| %>
>   <li id="min_set_<%= index %>">Minutes: <%= ff.text_field :minutes,
> :size => 2, :maxlength => 4 %>
>   Minimum Charge: <%= ff.text_field :min_charge, :size => 2 %>
>    <small><%= link_to_remote 'remove', :url => { :action =>
> 'remove_set', :index => index } %></small></li>
> <% end %>
>
> #_add_set_link.rhmtl
> <p id="add_set_link">
>   <%= link_to_remote 'add minimum set',
>       :url => { :action => 'add_set', :index => index } %>
> </p>
> ==========
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >

--
Robby Russell
Founder and Executive Director

PLANET ARGON, LLC
Design, Development, and Hosting with Ruby on Rails

http://www.planetargon.com/
http://www.robbyonrails.com/

+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4068 [fax]



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Deploying Rails" 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-deployment?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to