If the issue is in the create action please provide the corresponding
code. Model code would be helpful too.
Luke
On Sep 4, 5:51 am, ashu <rajeevsharm...@gmail.com> wrote:
> my models
>
> borrower ----- has_many :loans
> loan ----- belongs_to :borrower
>
> my loans _controller
>
> def new
> @borrower = Borrower.find(params[:borrower_id])
> logger.debug ' @borrower.id'
> logger.debug @borrower.id
> @loan = Loan.new
>
> respond_to do |format|
> format.html # new.html.erb
> format.xml { render :xml => @loan }
> end
> end
>
> def create
> logger.debug ' @borrower.id'
> logger.debug @borrower.id
> @loan = Loan.new(params[:loan])
> respond_to do |format|
> if @loan.save
> format.html { redirect_to(@loan, :notice => 'Loan was
> successfully created.') }
> format.xml { render :xml => @loan, :status
> => :created, :location => @loan }
> else
> format.html { render :action => "new" }
> format.xml { render :xml => @loan.errors, :status
> => :unprocessable_entity }
> end
> end
> end
>
> in my views i am passing value like this
>
> <%= link_to 'New Loan', :controller => 'loans', :action =>
> 'new', :borrower_id => @borrower.id %>
>
> every thing working fine in Action new logger.debug
> @borrower.id Gives id
> but on create it does not shows anything
> Where i am wrong and did something i missed i wanna save @borrower.id
> in @loans.borrower_id
> Please help thanks in advance
--
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.
No comments:
Post a Comment