Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7666111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:45:08+00:00 2026-05-31T14:45:08+00:00

I am trying to break out some methods that I am using across my

  • 0

I am trying to break out some methods that I am using across my backbone models, and I don’t understand why it isn’t working.

base_class.js.coffee

class MyApp.Models.BaseClass extends Backbone.Model

Linked: () =>
  @._linked

Link: (form) =>
  if @._linked == false
    $(form).backboneLink(@, {'prefixed':true})
    @._linked = true
  else
    $(form).backbonePopulate(@, {'prefixed':true})

Dirty: () ->
  @collection.Dirty()
  @._dirty = true

Clean: () ->
  @._dirty = false

isDirty: () =>
  @._dirty

page.js.coffee

#= require ./base_class

class MyApp.Models.Page extends MyApp.Models.BaseClass

  initialize: () ->
    console.log('Page Object initialized')
    @._dirty = false
    @changes = []
    @.name = 'Page'
    @._linked = false

 url: () ->
    '/pages/' + @id

However when I go into the console

page = new MyApp.Models.Page();    #=> Page Object initialized
page.Link($('#myform'));   #=>  Uncaught TypeError: Object #<Page> has no method 'Link'

I dont understand why the methods aren’t being inherited.

Here is a jsfiddle of the issue: http://jsfiddle.net/Y9bPX/11/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T14:45:09+00:00Added an answer on May 31, 2026 at 2:45 pm

    Your indentation is off. Your CoffeeScript looks like this:

    class MyApp.Models.BaseClass extends Backbone.Model
    
    Linked: () =>
      @._linked
    #...
    

    but it should look like this:

    class MyApp.Models.BaseClass extends Backbone.Model
    
      Linked: () =>
        @._linked
      #...
    

    Your lack of indentation gives you an empty MyApp.Models.BaseClass and then a bunch of inaccessible functions inside an anonymous object in the JavaScript:

    // CoffeeScript boilerplate...
    MyApp.Models.BaseClass = (function(_super) {
      // Standard CoffeeScript class boilerplate...
    })(Backbone.Model);
    
    ({
      Linked: function() {
        return _this._linked;
      },
      // etc...
    });
    

    So fix your indentation in your MyApp.Models.BaseClass and you should be fine. Remember that the entire block structure of CoffeeScript is based on the indentation so if you don’t have your indentation right then you have a bunch of nonsense.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When working with legacy code, and trying to create tests, I often break out
I am trying to help a friend of mine break his site out of
I am trying to break away from using tables in my formatting, and am
I'm trying to get some custom routing going on in Magento using the following
I am new to Objective C. Currently, I am trying out some examples in
I am converting my project to use DLLs and am trying to break apart
I'm trying to use a break statement in a for loop, but since I'm
I'm trying to find a way to break a string at the second last
i'm trying to get this program to break down a user defined amount of
I'm trying to use the CSS word-wrap property with break-word value. I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.