Remove Dociql static documentation - ruby-on-rails

I have generate dociql static documentation in my rails application. It has occupied my root route. I need to remove it permanently.
I tried to change the root route and also tried to remove the documentation but it didn't worked.

Related

Cannot find my View

All my Views are defined in a folder called "site_admin". But when I browse like this http://localhost:1234/site_admin/home/index. It gives me the following error
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /site_admin/home/index
It looks like its having problem finding the location of my View. All my views should be inside the "site_admin" folder and should be accessible from there.
Any help would be greatly appreciated.
Here is how routing works in MVC. Default routing means you have a controller, like UserController and in that file there is a method, say NewUser(...). Then you also need a view folder named User and inside that a NewUser.cshtml file. Now, if you to to mysite.com/User/NewUser that will first hit the User controller and look for the NewUser method. Once that code is run it will look for the NewUser.cshtml file in the Views/User folder.
There are several way of overriding this default routing (routeconfig.cs, route attributes, etc) but that is the basics of how it all ties together.

Generate URL of resources that are handled by Grails AssetPipeline

I need to access a local JSON file. Since Grails 2.4 implements the AssetPipeline plugin by default, I saved my local JSON file at:
/grails-app/assets/javascript/vendor/me/json/local.json
Now what I need is to generate a URL to this JSON file, to be used as a function parameter on my JavaScript's $.getJSON() . I've tried using:
var URL.local = ""${ raw(asset.assetPath(src: "local.json")) }";
but it generates an invalid link:
console.log(URL.local);
// prints /project/assets/local.json
// instead of /project/assets/vendor/me/json/local.json
I also encountered the same scenario with images that are handled by AssetPipeline1.9.9— that are supposed to be inserted dynamically on the page. How can I generate the URL pointing this resource? I know, I can always provide a static String for the URL, but it seems there would be a more proper solution.
EDIT
I was asked if I could move the local JSON file directly under the assets/javascript root directory instead of placing it under a subdirectory to for an easier solution. I prefer not to, for organization purposes.
Have you tried asset.assetPath(src: "/me/json/local.json")
The assets plugin looks in all of the immediate children of assets/. Your local.json file would need to be placed in /project/assets/foo/ for your current code to pick it up.
Check out the relevant documentation here which contains an example.
The first level deep within the assets folder is simply used for organization purposes and can contain folders of any name you wish. File types also don't need to be in any specific folder. These folders are omitted from the URL mappings and relative path calculations.

Grails app resource location in root directory

So my initial problem was that my static resources were placed to appName/static/ and what I wanted to do is to place them to just root directory.
I found this: grails.resources.uri.prefix property and thought that if I change it to '/' it'll all be fine, but now what happens is that it places the resources to appName/// instead.
Is there any way to place them into the app root directory?

Grails application root path

Is there a variable where I can find out the root directory of my Grails application?
for example, I have a folder named chart under \%root%\web-app\images\ where I put my charts in. Once I deploy my Grails application on Jetty, I will get FileNotFoundException because the root path becomes /srv/www/vhosts/domain-name/jetty-version/
I would like to know if there is a variable that returns the root path (like /srv/www/vhosts/domain-name/jetty-version/webapps/myapp), and there should be because CSS uses relative path just fine.
solved.
request.getSession().getServletContext().getRealPath("/")
this actually gives me the path to where my application puts the images, css, WEB-INF, etc. folders.
System.properties['base.dir']
I know it is an old question, but this could work if you are not in an http request:
ServletContextHolder.servletContext.getRealPath('/')
If you want to establish this is GSPs try this:
${createLink(uri: '/')}

Where and How to define Constant in Symfony?

I have a few of my own constants in symfony, and I need to make them available throughout the application, where to best define them?
I tried, in the directory myapps\config\config.php, define my constant in this way:
sfConfig::set('aaa', 'mya');
But when I tried to access the constant in myapps\apps\frontend\modules\login\actions\actions.class.php, using this comand
sfConfig::get('aaa')
I simply get a null, indicating that it hasn't been defined.
How and where to define symfony constant so that it is accessible throughout the whole project?
This is how I solved the problem:
Put the following into my myapp/apps/frontend/config/app.yml:
all:
.app_set:
bpobackend: me
bpoRedirectScreen: allow
Then in action module, call the var_dump to check the value
var_dump(sfConfig::get('app_bpobackend'));
looks like you are trying to use symfony 1.0 style configuration with symfony 1.1 or 1.2. all config.php files have been removed in 1.1. see Overview of the Configuration Files for what to use instead. and always be sure to look at the documentation for the proper version (1_2 (or whatever version you are using) in the url).
I have tried to add constant in the config.php in Symfony 1.0..
So If you want to add constant variables in config.php then
sfConfig::add(array('SF_DEFAULT_DATEFORMAT' => 'dd-MM-yyyy'));
This is the code where I have define the date format with name 'SF_DEFAULT_DATEFORMAT'...
So You can Tried with this One ...

Resources