Rails 3 Controller do not render page - rake

Is it possible in rails 3 to have a link pointing to a controller action, but not render anything?
Let's say I just want to call a couple rake tasks. Is this possible?

You can render nothing by using:
render :nothing => true
At the end of your action in the controller.

Call the method and add at the end of it a redirect_to or render to a site you want to view.
Don't forget to add this to your routes.
You can also use flash messages to show to the user that something happend :)

Related

Initializing component inside a home page in Ionic4

I have a Home Page, inside that I have created one component RecentlyViewedProductComponent.
My problem is:
when I navigate to /home by using
this.router.navigate(['/home']);
the ngOnInit() inside RecentlyViewedProductComponent is not working. When I close the app and open it again, that only it is working .
How to solve this problem?
It sounds like you are not using the right lifecycle event.
Have you looked at the documentation here:
https://ionicframework.com/docs/angular/lifecycle
It says that ngOnInit() is:
Fired once during component initialization. This event can be used to initialize local members and make calls into services that only need to be done once.
If you want it to be called every time you navigate to the home page then you want to replace this with something like ionViewWillEnter():
Fired when the component routing to is about to animate into view.
There is actually some guidance at the end of the docs page that you might find interesting which explains when to use each life cycle method.

Function across multiple view controllers

I am trying to make a function so that I request a 'manager override' where it presents a screen for a manager to enter their password and press an approve button. How should I do this? Will it have to be in multiple functions? Is there a way that I can call one function and it present the information back? Would a completion work for what I need? I have no ideas where to start for this.
My set up is as follows:
A view controller asks for manager approval, then a screen slides up with text boxes and an approve button. I want the approve button to trigger authenticating and dismissing the screen
Assuming you don't want a Framework target (that sounds like overkill for what you want) simply mark the function as "public" and move it outside of any class. I just tried in a sample project and it works.
It looks important - remember to keep it in a file already in the project. (My sample project didn't work with menu option File|Add|New|File.)
Now, if you really want portability, check out how to create a Framework project.

Zend framework --- Action code before rendering view

When I use zend framework, how to run action code in controller before rendering view?
Now I use 2 action functions,
The first one have no view. The second one have the expected view.
When the first function is called, at the end of the function it will be redirected to call the second function.
Although I find this method works, the user cannot go back to last page by browser back button.
i don't understand your question so much but ...
Controller is always run before render action. Its a logic which running before render is called. I dont know from your question what you really need =( try be more objective pls. If you need run any code before action in controller on all actions in controller, you use init or preDispatch functions.
http://zfreak.wordpress.com/2011/04/14/usage-of-init-vs-predispatch-methods-in-zend-front-controller-zend-framework/
If you need 2 separated logics, you can make own function or class in your project and call it or create instance anywhere you need. If your problem is with any render as ACL restrictions... i use own function in controller which retrieve error_access_page and after call $this->_helper->viewRenderer->setNoRender(). If my users not have access, this show error_page and no render action's phtml file.
hope help =]

Is it possible to call a URL without a visible view?

Is it possible to load a URL without a visible view?
Basically I'm trying to submit some information to my server by a php page. It works from my webViewController, which has a working view, but not from my appDelegate, which doesn't have a visible view.
I recommend you use ASIHTTPRequest to submit the information to your php page.

Discover which (if any) route will match a given URL from within Controller in ASP.NET MVC2 app

In my master page I have a placeholder where a Html.RenderPartial() will render a collection of (bread)crumbs which are effectively a list of links I build up using action, controller names and RouteValueDictionary's.
I have an action that is called from multiple places to view a short-list and so when building the list of breadcrumbs for this actions view to display. Ideally I'd like to use Request.UrlReferer as the penultimate crumb.
Before unconditionally using this URL I want to check that it will actually match at least 1 route so I can be sure if the user clicks it they will get a view from my app and if they don't I will simply use the home page instead.
Any suggestions how I would go about this?
Take a look at this post http://haacked.com/archive/2007/12/17/testing-routes-in-asp.net-mvc.aspx