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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:49:24+00:00 2026-05-23T01:49:24+00:00

Im using Sproutcore and Rails and wonder where to put strings like attribute slugs

  • 0

Im using Sproutcore and Rails and wonder where to put strings like attribute slugs and comments.

In the model layer I have some model classes eg.

SC.User = SC.Record.extend({

  firstName: '',

})

Should I put the attribute slugs and comments here in the model classes:

SC.User = SC.Record.extend({

  firstName: '',
  firstNameSlug: 'First name',
  firstNameComment: 'Enter your first name',

})

Or should these be in the views decoupled from the models?

The benefit of having the in the model classes is that I now can have a generic view that iterates all model attributes and shows them automatically.

What do you think?

  • 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-23T01:49:24+00:00Added an answer on May 23, 2026 at 1:49 am

    Sproutcore is based on the model-view-controller paradigm, moreover it uses a rather conservative strict version of mvc. Your model should only contain the real values of a certain domain object. Hence, you shoudn’t place your comment and placeholder strings within your model-object.

    Instead use your controller to bind to your model object as well as to all additional properties you want to discouple from your view. A typical controller setup might look as follows

    YourApp.userController = SC.ObjectController.extends({
        user: SC.User.create({ ... }), // Create a new user or load one from the store
        firstNamePlaceholder: 'First name',
        firstNameComment: 'Enter your first name',
        ...
    });
    

    It might make sense to combine the additional properties within a controller in one or more objects defined inside the controller to do some grouping, e.g.

    YourApp.userController = SC.ObjectController.extends({
        user: SC.User.create(),
        placeholder: SC.Object.create({
            firstName: 'First name',
            lastName:  'Last name',
        }),
        comment: SC.Object.create({
            firstName: 'Enter your first name',
            lastName: 'Enter your last name'
        })
    });
    

    This might lead to a cleaner structure in your views later on.

    To put this in a nutshell, think of your model objects as traditional domain objects without class parameters use only parameters which are (potentially) unique to each instance of your domain object. Everything else goes into your controller layer. Make sure your views stay as dump as possible and only include bindings to all required application states.

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

Sidebar

Related Questions

Using Rails 3.2.0 with haml and sass: I Would like to link an external
Using MVC2 I have an AJAX form which is posting to a bound model.
I'm using sproutcore, and I use sc-gen to generate a controller like this (this
Does anyone have any experience of using SproutCore together with ASP.NET MVC? For what
Using Rails 3.2.0.rc2 and ruby 1.9.3p0 In app/views/requests/_form.html.erb I have the following code for
I'd like to start developing a new project using sproutcore. Since 2.0 seems quite
Several frameworks for writing web-based desktop-like applications have recently appeared. E.g. SproutCore and Cappuccino
Hey... I started using Javascript MVC SproutCore Framework (sproutcore.com) and I found it impressive.
Using online interfaces to a version control system is a nice way to have
Using C# .NET 3.5 and WCF, I'm trying to write out some of the

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.