Once set, the value of app.locals properties persist throughout the life of the application.
Is there a way this can be achieved with rails?
Check those great gems, they are exactly what you need:
https://github.com/railsconfig/config
https://github.com/laserlemon/figaro
Related
I am using angular dart to create a web application.
I have a page where i use material input to get input from the user. in that, i need to have a default initial value in the text box as soon as the page is loaded.
I don't want to bind the input to any variable as this is just a one time use and i will not need binding from component to template after this.
is there a way to specify default/initial value for 'material-input' in dart?
You're probably looking for hintText.
<material-input hintText="Initial value">
</material-input>
From the notes above:
<material-input [ngModel]="value">
Was the solution he used. This will push the value into the input without having it be a two way variable. Nate's suggestion of using hintText is also a good use of this.
In the IndexController, I have two properties, from and to, both containing an instance of the Date object.
I have set up one separate observer for each property and run my overlap-prevention logic in there -- is this the right approach?
Here's the JS Bin: http://jsbin.com/yijezebetaya/1/
Yes, that approach is perfectly acceptable.
I need a way for ember router to route to a recursive path.
For Example:
/:module
/:module/:submodule
/:module/:submodule/:submodule
/:module/:submodule/:submodule/...
Can this be done with Embers router, and if so, how?
I've been looking for examples, tearing apart the source, and I've pretty much come to the conclusion, it's not possible.
In a previous question, someone had pointed me to a way to get the url manually and split it, but I'm stuck at creating the state for the router to resolve to.
As of now, in my project, I currently just use the Ember.HashLocation to setup my own state manager.
The reason for the need of this, is because the module definitions are stored in a database, and at any given point a submodule of a submodule, recursively, could be added. So I'm trying to make the Application Engine handle the change.
Do your submodules in the database not have unique IDs? It seems to me that rather than representing your hierarchy in the path, you should just go straight to the appropriate module or submodule. Of course the hierarchy is still in your data model, but it shouldn't have to be represented in your routing scheme. Just use:
/module/:moduleId
/submodule/:submoduleId
And don't encode the hierarchy in the routes. I understand it might be natural to do so, but there's probably not a technical reason to.
If your submodules don't have unique ids, it's maybe a little tougher...you could build a unique ID by concatenating the ancestor ids together (say, with underscores), which is similar to splitting the URL, but a little cleaner probably. I will say that Ember/Ember Data doesn't seem to be too easy to use with entities with composite keys--if everything has a simple numeric key everything becomes easier (anyone want to argue with me on this, please explain to me how!).
DO you mean like this:
App.Router.map(function(match) {
match('/posts').to('blogPosts');
match('/posts/:blog_post_id').to('showBlogPost');
});
My Ember.js model, view, and controller classes are getting a bit verbose. Part of this comes from writing this.get('attr') instead of this.attr.
Is it OK to always just write this.attr, as long as the attribute is declared directly, not via a binding?
(I understand that setting is a different issue -- you always have to call this.set('attr', value) in order to update dependent attributes and templates.)
IIRC, you can do this for private properties that you know will not be observable.
The convention is to prefix your private properties with an underscore (eg _myProperty) which tells Ember not to bind it.
See the docs for .get(), or check the source code if you're so inclined.
If the property is being observed or bound, you DON'T want to do 'this.attr'. The get command is the nexus through which observers and bindings are triggered.
The previous answers to that question are outdated by recent version of Ember. Since 3.1, which was released in April 2018, native ES5 getters could be used for computed properties also. In Ember 3.1 this.get('attr') is the object uses unknownProperty, is an Ember Data PromiseProxyObject or if using with a path and some elements of it may not be an object. Please refer to release notes for details. You will get a helpful assertion in that cases.
I'm taking over a project and wanted to understand if this is common practice using SOAP. The process that is currently in place I have to query all the values before I do an update cause I need to pass back all the values that are not being updated. Does this sound right?
Example Values:
fname=phill
lname=pafford
address=123 main
phone:222-555-1212
So if I just wanted to update the phone number I need to query for the record, get all the values and submit these values for an update.
Example Update Values:
fname=phill
lname=pafford
address=123 main
phone:111-555-1212
I just want to know if this is common practice or should I change the functionality of this?
This is not specific to SOAP. It may simply be how the service is designed. In general, there will be fields that can only be updated if you have the original value: you can't add one to a field unless you know the original value, for instance. The service seems to have been designed for the general case.
I don't think that it is a very "common" practice. However I've seen cases where the old values are posted together with the new values, in order to validate that noone else has updated the values in the meantime.