[Rails] What's the best way to embed a form?: Header showing multiple times?

softwareengineer 99 softwareengineer99 at yahoo.com
Sun Feb 5 19:20:42 GMT 2006


Byron,
  Thank you for your reply.
  
  That did the trick.
  
  Big thanks to Xavier also for spending a great deal of his weekend on assisting me.
  
  ROR is the future.
  
  Frank

Byron Saltysiak <byronsalty at gmail.com> wrote:  You can change the rendering of layouts in a more declarative way at the top of controllers with something like: 
  
  layout "application", :except => [ :login_form ]

On 2/5/06, softwareengineer 99 <softwareengineer99 at yahoo.com  > wrote:After some digging around, I found the solution to the error:
  
"::MemberController" is not a valid constant name!
  The error goes away if I comment out the following line in member_controller.rb
  
  before_filter :login_required
  
  
  My MemberController has the following layout applied to it  
  class MemberController < ApplicationController
    layout  'default-layout'

  This is causing the header to show up two times (even for my new method login_form).
  
  How can I have a default layout applied to a Controller and then turn it off for one function?  
  
  Currently my tags/show.rhtml reads
  
  <%= render_component :controller => "member",  :action => "login_form"%>
  
  And my login_form definition in member_controller is:  
  
  def login_form
      return if generate_blank
      @member = Member.new(@params['member'])
        if @session['member'] = Member.authenticate(@params['member']['login'], @params['member']['password'])
        flash['notice'] = l(:member_login_succeeded)
        redirect_back_or_default :action => 'welcome'  
      else
        @login = @params['member']['login']
        flash.now['message'] = l(:member_login_failed)
      end
      render :layout => false
    end
  
  Why isn't the render :layout => false working here?   
  
  I thought it would be nice to have the layout applied to the entire  controller. But I didn't know that tunring it off will become such a  hassle?
  
 So what are the best practices in this case? Is it  good to apply a "global" layout and then turn it off for each function  (which isn't working for me) or not have a "global" layout and then  apply it for each method?
  
  Needless to say, I am so confused with layouts here.
  
  Your continued assistance is highly appreciated. I am sure this will help a lot of new learners here too.
  
  Frank  
  
  
Xavier Noria <fxn at hashref.com> wrote:    On Feb 4, 2006, at 23:53, softwareengineer 99 wrote:

> Thank you Xavier for your reply:

       

---------------------------------
 Yahoo! Mail - Helps protect you from nasty viruses.  

_______________________________________________
Rails mailing list
Rails at lists.rubyonrails.org  
http://lists.rubyonrails.org/mailman/listinfo/rails



  


-- 
Byron
http://byron.saltysiak.com  _______________________________________________
Rails mailing list
Rails at lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails


		
---------------------------------
Brings words and photos together (easily) with
 PhotoMail  - it's free and works with Yahoo! Mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060205/0220dc00/attachment-0001.html


More information about the Rails mailing list