Friday, October 23, 2009

[Rails] Re: Deployment syntax error: fine in dev - what's happening?

On Oct 23, 2:57 pm, Alan Fleming <rails-mailing-l...@andreas-s.net>
wrote:
> I'm deploying an app (using Capistrano) to a staging server prior to
> final deployment.  The app runs fine in dev, but in staging it throws a
> syntax error. How can that be?
>

Well the code looks wrong to me - inside the begin you have each
unless and if, but only 2 ends before the rescue (you don't seem to
have indented the each).
A big difference between development and production is that in
development files are loaded when needed, so if there is a syntax
error you hear about it when that file is used, whereas in production
rails loads all your classes up front so you get the error upon
startup.

Fred

> The error is:
>
> /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require':
> /Library/WebServer/staging.givetothem.co.uk/releases/20091023133654/app/con trollers/bulkimport_controller.rb:32:
> syntax error, unexpected kRESCUE, expecting kEND (SyntaxError)
>       rescue Exception
>             ^
>
> The code generating the error is:
>
>       begin
>         @parsed_file=CSV::Reader.parse(params[:dump][:file])
>         n=0
>         @parsed_file.each do |row|
>         unless row[0].nil?
>           c...@recipients.new
>           c.address=row[0]
>           if c.save
>             n=n+1
>             GC.start if n%50==0
>           end
>         end
>       rescue Exception
>         flash.now[:error]="Import failed! Please check the file and try
> again."
>       else
>         flash.now[:notice]="Import successful,  #{n} new addresses added
> to your list."
>       end
>
> Another couple errors are then thrown: two lines further complaining
> about the else, then at EOF still expecting kEND.
>
> I can't see it, and textmate suggests I've all my starts and ends lined
> up. What am I doing wrong? And more importantly, does anyone have any
> idea why is is showing in staging only and not in my dev environment?
>
> Rails is 2.3.4 on both, Ruby is 1.8.7pl72, gems are frozen in, OSes is
> OSX Snow Leopard & Snow Leopard server.
>
> Thanks in advance for any help - I'm a relative newb at this.
>
> Alan.
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate