mahesh s wrote:
> Maheshror
>
> def create
>> @animal = Animal.new(params[:animal])
>> respond_to do |format|
>> #INCLUDE THIS LINE
>> if @animal.valid?
>> #if @animal.save
>>
>>
> animal.save
>
>> end
>>
>
> try this
ok dear but it can not save record on table this is new problem.
i think u tell me like this ?
---------------------
def create
@animal = Animal.new(params[:animal])
respond_to do |format|
#if @animal.save
if @animal.valid?
flash[:notice] = 'Animal was successfully created.'
format.html { redirect_to(@animal) }
format.xml { render :xml => @animal, :status => :created,
:location => @animal }
else
format.html { render :action => "new" }
format.xml { render :xml => @animal.errors, :status =>
:unprocessable_entity }
end
end
end
-------------------
--
Posted via http://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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---