A friend just commented on the gist and pointed out that I have an "elsif" 
without following it by a conditional. Replacing it with an "else" fixes it in 
both staging and production.

I guess the real bug is why doesn't it have the syntax error in development?
On Monday, May 23, 2011 at 3:31 PM, Anoop Ranganath wrote:
Sorry about that:
> 
> https://gist.github.com/987371
> 
> The first file is the code that gets the syntax error in staging but not in 
> development. By adding the "= nil" in the second file, it works in both 
> staging and development.
> 
> Thanks!
> Anoop
> On Monday, May 23, 2011 at 3:28 PM, Nathan Weizenbaum wrote: 
> > Please post the code somewhere where the indentation doesn't get mangled 
> > (that is, not via email).
> > 
> > On Sun, May 22, 2011 at 8:39 PM, Anoop Ranganath <an...@ranganath.com> 
> > wrote:
> > > I am using a form_for which works wonderfully in the development 
> > > environment. The code around it looks like this:
> > > 
> > >  - if user_signed_in?
> > >  Welcome, #{link_to current_user.first_name, user_path(current_user)}
> > >  = link_to "Sign out", logout_path
> > >  - elsif
> > >  = form_for :user, :url => login_path do |f|
> > >  = f.label :email
> > >  = f.text_field :email
> > >  %br
> > >  = f.label :password
> > >  = f.password_field :password
> > >  %br
> > >  = submit_tag 'Log in'
> > > 
> > >  It's fairly straightforward. This code works perfectly in development, 
> > > but when run in the staging environment, I get a syntax error:
> > > 
> > >  syntax error, unexpected tSYMBEG, expecting keyword_do or '{' or '('
> > >  haml_temp = form_for :user, :url => login_path do |f|
> > > 
> > >  The error is happening at the :user symbol. Here's the weird thing. If I 
> > > add in a throwaway line before the form_for, this code works perfectly. 
> > > In this case, I add "= nil". The code looks like this and everything 
> > > works:
> > > 
> > >  - if user_signed_in?
> > >  Welcome, #{link_to current_user.first_name, user_path(current_user)}
> > >  = link_to "Sign out", logout_path
> > >  - elsif
> > >  = nil
> > >  = form_for :user, :url => login_path do |f|
> > >  = f.label :email
> > >  = f.text_field :email
> > >  %br
> > >  = f.label :password
> > >  = f.password_field :password
> > >  %br
> > >  = submit_tag 'Log in'
> > > 
> > > 
> > >  Any ideas what I might be doing wrong?
> > > 
> > >  Thanks!
> > >  Anoop
> > > 
> > > 
> > > 
> > >  --
> > >  You received this message because you are subscribed to the Google 
> > > Groups "Haml" group.
> > >  To post to this group, send email to haml@googlegroups.com.
> > >  To unsubscribe from this group, send email to 
> > > haml+unsubscr...@googlegroups.com.
> > >  For more options, visit this group at 
> > > http://groups.google.com/group/haml?hl=en.
> >  -- 
> >  You received this message because you are subscribed to the Google Groups 
> > "Haml" group.
> >  To post to this group, send email to haml@googlegroups.com.
> >  To unsubscribe from this group, send email to 
> > haml+unsubscr...@googlegroups.com.
> >  For more options, visit this group at 
> > http://groups.google.com/group/haml?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to haml@googlegroups.com.
To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Reply via email to