I am trying to add a custom method on one of my CFWheels Model but I am not able to do this. I have been reading the documentation but still not found an answer.
User.cfc
component extends="Component" {
...
function getCustomSearch(){
...
}
...
}
I want to change:
model("users").findAll(...)
To
model("users").getCustomSearch(...)
In order to refactor some function.
Is this possible? In that case, what I am doing wrong?
Thank you for your attention.
Regards.
It will need to be model('user') not users; Wheels looks for the singular variant to match the models/User.cfc file.
I have left my computer and when I came back it was working. Dan Roberts was right, it's necessary to reload.
Thanks to all for the help!
Related
Is there a way to get the class or type of a model? For example if my model was a "todo" and if I wanted to get that information from the record itself like:
todo = this.get('model');
todo.class
OR would it possible to get it from the 'content' of a controller? I think model is just an alias for content but I could be wrong. I figured there has to be a simple way to do this but I can't find anything after much googling. Thanks in advance for the help.
the constructor is probably what you're looking for, it's located on the proto of the object
`todo.constructor`
http://emberjs.jsbin.com/OxIDiVU/871/edit
I got it working with the following:
type = #get('model').get('constructor.typeKey')
Thanks to kingpin2k for the help.
I want to get TypeSyntax from TypeSymbol.
Based on the answer to the Get TypeSyntax from ITypeSymbol question, my solution is Syntax.ParseTypeName(typeSymbol.ToDisplayString()) which doesn't look good.
Is there a more direct solution?
I am not sure if this is what you are looking for but this works forks for me. I get TypeSyntax of declared method parameter using SyntaxReferences this way:
(Symbol.DeclaringSyntaxReferences.First().GetSyntax() as ParameterSyntax).Type
I would like to "current location bar" id Django. Something like on eBay under the "Women clothing" (eBay>Fashion>Women's Clothing), but I don't really know how to do it.
I was wondering if I should use request.get_full_path() or something like that, but it seems very dirty to me.
Thanks in advance,
Adam
What you're looking for is called "breadcrumbs" and you can find a nice snippet here
As said there:
The URL
/users/foo/config/
will get to these breadcrumbs:
Users>>foo>>Config
which is basically the correct way to understand this snippet!
Hope it helps
you're wanting the full breadcrumb trail?
Usually you just use django's url template tag: https://docs.djangoproject.com/en/1.3/ref/templates/builtins/#url and reverse each known url for where you are on the site.
I just don't really get this part
Say you clear a collection of tags by
calling $post->getTags()->clear(); and
then call $post->getTags()->add($tag).
This will not recognize tag being
already added before and issue two
database calls.
What 2 database calls will be issued? Delete all tags of the post then add one? Thats what I'd expect? Or will it be something else?
Did you try to call after the clear?
$entityManager->flush();
If this don't help try to remove one by one in foreach.
The goal is to make users be more specific when reporting a bug.
Ususally I get a messy report "It doesn't work, please help ASAP!" from a user, so I keep asking the same questions each time -- "The why, the who-what-when, the where, and the how..."
Instead, I want to set a template for a new issue, something like this:
What page did you go? What login did you use?
What did you see?
What did you expect to see?
Why do you think this is a bug?
or whatever.
Is it possible?
This plugin would be very helpful, in your case,
Issue Templates- http://www.redmine.org/plugins/issue_templates
here is a patch for templating issue descriptions. anything beyond that is still underway, and is relevant to the issue mentioned above.
http://www.redmine.org/issues/2931
The link below says that you can for the last year or so:
http://www.redmine.org/issues/1138
But I haven't yet found a description of how this functionality is used. I guess I'll have to slog through some code to find out.
Maybe a possible workaround is to have an issue to use as a template.
Create an issue like this:
name: Bug template
description:
What page did you go?
What login did you use?
What did you see?
What did you expect to see?
Why do you think this is a bug?
Then you can duplicate it each time you need a real issue.
The limit is with issues with subtasks. If you duplicate the parent issue you don't get the subtasks duplicated as well.