Rails 2.3.2. Yeah, I meant that is the view. The relevant actions in
the controller are:
# GET /links/new
# GET /links/new.xml
def new
@link = Link.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @link }
end
end
# POST /links
# POST /links.xml
def create
@link = Link.new(params[:link])
@link = current_user.links.build(params[:link])
@link.title = WWW::Mechanize.new.get(@link.url).title
respond_to do |format|
if @link.save
flash[:notice] = 'Link was successfully created.'
format.html { redirect_to(@link) }
format.xml { render :xml => @link, :status => :created,
:location => @link }
else
format.html { render :action => "new" }
format.xml { render :xml => @link.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
-~----------~----~----~----~------~----~------~--~---