开发者

Having problems creating a Renew action and view in Rails3

开发者 https://www.devze.com 2023-02-09 02:19 出处:网络
please can somebody help me with this .i want to create a renew link which will update some of the fields in a tab开发者_Go百科le called members,am using rails 3 and i have created my action and the c

please can somebody help me with this .i want to create a renew link which will update some of the fields in a tab开发者_Go百科le called members,am using rails 3 and i have created my action and the corresponding view but i still have an error that states

"undefined method'renew_member_path' for #<#:0xb66bcae0>"

below is the action i created in the members_controller

Class MembersController

def renew
  @member = Member.find(params[:id])
  respond_to do |format|
    if @member.renew_attributes(params[:member])
      format.html { redirect_to(@member, :notice => 'Member was succesfully Renewed.'}
      format.xml  {head :ok }
    else
      format.html { render :action => 'renew'} 
      format.xml { render :xml => @member.errors, :status => :unprocessable_entity}
    end
  end
end

I created a view called renew.html.erb


Your route is not set. You need to update your routes.rb file to something like this:

match 'members/renew' => 'members#renew', :as => :renew_member
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号