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 8150979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:13:26+00:00 2026-06-06T15:13:26+00:00

I am new to backbone and trying out my first app after going through

  • 0

I am new to backbone and trying out my first app after going through a few tutorial apps.

I was wondering what is the best way to accomplish the following

On the backend(rails)

I have a model name Business, It is a complex model with a lot of attributes, It has an associated address (has_one :address) and has an avatar and another profile pitcure and lot more.

From my frontend I want to be able to fetch and update specific parts of the business profile, Lets say I only want to fetch the basic_info which includes name, category and address than I want to be able to update the profile picture and the avatar.

What I have seen in backbone is that the model has the methods save, update, fetch, destroy

What if I want to have other methods like fetch_basic_info, fetch_profile_picture, update_profile_picture ? and against these I want the associated views to be notified accordingly.

Here is what I have come up with

Lets say I want to fetch basic info

  • add a function fetch_basci_info to the backbone model

    • inside this function send an custom ajax request using $.ajax to the server
    • manually trigger the event "basicinfo:fetched"
  • inside my router function

    • create model object
    • create a new view lets say BasicInfoView and pass it the model object
    • inside the view bind an even of the model lets say model.bind('basicinfo:fetched', this.render)
    • when the router is initialized call model.fetch_basic_info (in the router init)

So the router is called it creates view binds a custom event and calls model.fetch_basic_info() request is sent to the server response is returned ( do I call set manually to set the attributes of the backbone model here). After that the custom event event is triggered the view is notified and it renders itself

This is my first real backbone application so if I am doing something really out of the way stop me.

What are your thoughts on this.

Thank you for reading and feedbcak.

  • 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-06-06T15:13:28+00:00Added an answer on June 6, 2026 at 3:13 pm

    What you’re trying to do isn’t very RESTful. If you’re trying to do this to save resources or network bandwidth then its almost certainly a premature optimization – unless we are talking about hundreds or thousands of fields – in which case there’s a better solution.

    The truth is, Fetching just a profile picture uses just about the same resources as fetching 50-100 fields. Yes slightly more data, but considering 90% of the work, latency, resources and waiting time in a network connection comes from establishing the connection you’re not actually saving that much.

    Plus on the database end, a

    select * from businesses where id=123

    uses only a tiny bit more than

    select profilepic from businesses where id=123

    since the hardest part of the job is establishing a connection to the database and finding the correct row. After that, its just a bit more data – adding 50 extra columns will have an unnoticeable effect on performance.

    The only time this falls over is if your model / table contains hundreds or thousands of attributes. In this case the solution is to split your model up into sub-models. And deal with them individually via REST. But they should be Business logic types. For example Business contains Address, Employee, ShareStructure.

    I myself used to be a premature optimizer… “Must not return 10 columns when I only need 1 column”. But if try try to write web service APIs for every subset of data in its varying combinations you might ever need, your API will be practically unusable and unmaintainable. You’ll also never get any work done.

    Say you wanted to get CocaCola’s profile picture off facebook’s API, you would just call:

    https://graph.facebook.com/cocacola

    and get the Picture property. Who cares if you don’t need the rest of the data? It keeps things simple, restful and easy to maintain.

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

Sidebar

Related Questions

I am very new to Backbone and just trying to figure out the way
I've got a Backbone.js/Rails app and I'm trying to create a new object through
I am new to Backbone and started by working through the Todos example. After
Basically I'm trying to figure out the best way to swap a model and
I am using backbone and trying to create a new object and I am
I'm pretty new to backbone.js and am still learning how everything works. I'm trying
I'm very new to backbone but I manage to get it working from tutorial.
I'm new to backbone and trying to set it up in Sinatra, but I
I'm trying to get my backbone associations working inside a rails app , and
I'm trying to make a quick sample Backbone.js app that has a Post model,

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.