Click here to Skip to main content
15,892,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to figure out the problem(I am new to ruby ) that I am facing but I can't figure out the problem. I can't figure out how to explain the problem so if you have an doubt you can ask.now getting to the main question When ever updateRequest function of the request is called it throws an error which is

XML
NoMethodError at requests/bookmark_request


 undefined method `empty?' for #<Request:0x007f3fa44c59b0



I am posting the code over here.

bookmark_request code

<br />
  def bookmark_request<br />
    data = params[:d]<br />
    request_bookmarked = Request.getRequest(data)<br />
    bookmarked_against_Request = Request.first<br />
    request_bookmarked_2 = request_bookmarked<br />
    bookmarked_against_Request_2 = bookmarked_against_Request<br />
    #t = Array.new<br />
    #t << request_bookmarked[:_id]<br />
    #Rails.logger.info("Bookmark 2: #{bookmarked_against_Request_2.inspect}")<br />
    if bookmarked_against_Request_2[:favourites]<br />
      bookmarked_against_Request_2[:favourites] << bookmarked_against_Request[:id]<br />
    else<br />
      bookmarked_against_Request_2[:favourites] = Array.new<br />
      bookmarked_against_Request_2[:favourites] << bookmarked_against_Request[:id]<br />
    end  <br />
    #request_bookmarked_2[:favourites_of] << bookmarked_against_Request[:id]<br />
    #hello<br />
    #Request.updateRequest(request_bookmarked , request_bookmarked_2)<br />
    Request.updateRequest(bookmarked_against_Request , bookmarked_against_Request_2)<br />
    redirect_to :action => "active"<br />
  end<br />


Request.updateRequest code is here

<br />
 def updateRequest(request,req_data)<br />
      if request.update(req_data)<br />
        request<br />
      end<br />
    end<br />
<br />


it throws an error on request.update(req_data)

Please tell me what is it that I am doing wrong
Posted
Updated 3-Apr-15 18:17pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900