walther curly_a diechmann punta net wrote:
> I have a account_controller.rb with
>
> def login
> ....
>      else
>         flash[:error] = "False username/password - try again, please!"
>         render :partial => 'login'
>      end
> end
>
> I have a _login.haml with
> .....
>     - form_remote_tag( :update=> {:success => 'documentcontent'}, :url
> => { :controller => 'account', :action => 'login' }) do
>       %table
> .....
>
> ....
>             = if flash[:error]
>               %span.error-message
>                 flash[:error]
> ....
>   
I can see one problem right away. You shouldn't do "= if ..."; you don't 
want to output the result of the if statement (which is undefined and 
apt to create crazy things). Try making that "- if flash[:error]".
> If I comment out the flash[.error] in my account_controller.rb
> everything plays nice (ie my documentcontent div gets filled with the
> output from _login.haml) - but if I leave the flash[:error] in there,
> the update fills the span.error-message with not only the
> flash[:error], but the entire output from _login.haml!!
>   
I'm a little confused. Why wouldn't this happen? If you're rendering the 
entire partial, wouldn't you expect the entire partial to show up?
> I know I'm supposed to do this in some other fashion, but endless
> tests unfortunately have not revealed this to me :(
>
> My question is:
>
> If I like to do a render partial on a form_remote_tag, how can I refer
> to the flash[:error] - and it is not outside the div being updated, it
> is inside like in this example
>
> <div id="to be updated by Ajax.Updater">
>      <!-- result from render :partial=>'action' -->
>      conditional span with flash[:error]
> </div>
>   
See above comment about "-" versus "=".

Let me know if that helps.

- Nathan


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

Reply via email to