NoMethodError at /delete/1 private method `delete'...

Discussion in 'Ruby' started by Joe dude, Nov 30, 2009.

  1. Joe dude

    Joe dude Guest

    Hello,

    I'm trying to work through the 'Meet Sinatra' PeepCode screencast and
    I'm stuck trying to delete an entry.

    I'm receiving this error while attempting to delete a file and database
    entry:

    NoMethodError at /delete/1
    private method `delete' called for #<Ad:0x102949028>

    * file: adserver.rb
    * location: GET /delete/:id
    * line: 72

    Here's the entire adserver.rb file:
    http://pastie.org/719776

    Here's the handler that's causing problems:
    http://pastie.org/719777

    The error is being caused by: "ad.delete"

    When the URL that is supposed to remove the file and delete the db entry
    is visited (mysite.com/delete/1), the file is removed and then I receive
    the error that I posted above.

    Any feedback is appreciated.

    Thank you
    --
    Posted via http://www.ruby-forum.com/.
    Joe dude, Nov 30, 2009
    #1
    1. Advertising

  2. Joe dude

    Ryan Davis Guest

    On Nov 29, 2009, at 17:50 , Joe dude wrote:

    > Hello,
    >=20
    > I'm trying to work through the 'Meet Sinatra' PeepCode screencast and
    > I'm stuck trying to delete an entry.
    >=20
    > I'm receiving this error while attempting to delete a file and =

    database
    > entry:
    >=20
    > NoMethodError at /delete/1
    > private method `delete' called for #<Ad:0x102949028>
    >=20
    > * file: adserver.rb
    > * location: GET /delete/:id
    > * line: 72
    >=20
    > Here's the entire adserver.rb file:
    > http://pastie.org/719776
    >=20
    > Here's the handler that's causing problems:
    > http://pastie.org/719777


    First off, you should probably ask this question either on the sinatra =
    mailing list or the datamapper mailing list for a better and more =
    accurate response.

    Second, without a full backtrace we can only speculate.

    If the method is private, make it public... but it is probably private =
    for a reason. Looking at the API, you might want to call destroy =
    instead.
    Ryan Davis, Nov 30, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. anon1m0us
    Replies:
    2
    Views:
    214
    anon1m0us
    Feb 6, 2007
  2. anansi
    Replies:
    8
    Views:
    134
    Evan Light
    May 8, 2007
  3. Replies:
    2
    Views:
    115
  4. Sukeerthi Adiga

    NoMethodError: private method `to_date'

    Sukeerthi Adiga, Feb 25, 2008, in forum: Ruby
    Replies:
    11
    Views:
    395
    P. mark Anderson
    Jul 24, 2008
  5. salai
    Replies:
    3
    Views:
    190
    salai
    Jun 30, 2009
Loading...

Share This Page