controller

Extending the IndexController with a BaseController in Zend

I'm trying to extend my controllers with a global base controller as such: class BaseController extends Zend_Controller_Action { // common controller actions public function listAction() { // do stuff } } class IndexController extends BaseController { // index controller specific actions } class LoginController exten...

With nested routes does the parent controller or the child controller process the request for the "new" action?

If you have a nested resource defined like this: map.resources :magazines, :has_many => :ads. for these models: class Magazine < ActiveRecord::Base has_many :ads end class Ad < ActiveRecord::Base belongs_to :magazine end When you invoke this url: /magazines/1/ads/1/new with the nested route helper: new_magazine_ad_pa...

spring mvc: get the part url of the current request relative to the controller

In spring mvc I have a controller that listens to all requests comming to /my/app/path/controller/*. Let's say a request comes to /my/app/path/controller/blah/blah/blah/1/2/3 How do I get the /blah/blah/blah/1/2/3 part, i.e. the part that matches the * in the handler mapping definition. In other words I am looking for something simila...

Editing Multiple Records - Granting Access to All Logged-In Users

As far as I can tell, this is a views and controller problem. I need to allow users to edit multiple records in one of my database tables. Railscast 165 deals with a similar situation, but it's not quite on point for me: http://railscasts.com/episodes/165-edit-multiple I have a fixed set of products, and I need to let users add as...

Cannot render form tag using 'render' in Grails Controller

Using markup with the render is not adding the form tag. I tried this with contentType "text/html", "txt/xml" and it does not work. I have this in my controller: def myTest= { render(contentType: "text/plain") { div(id:"myDiv") { p "somess text inside the div" form (action:'get') { p "inside form" } } ...

How to define Spring datasource in controller ?

Is it possible to define a datasource connector in a Spring controller ? I'm working on a tool : synchronize a source table to a target table. I would define source and target in my controller (to synchronize different databases - in my view I can select different source and target databases). Actually, I define my datasource in file c...

Implementation differences between Zend_Rest_Server & Zend_Rest_Controller

There seems to be two different ways in the Zend Framework to implement a RESTful API, one by adding objects&functions to the Zend Rest Server object inside a action controller, the other through extending the very sparsely documented Zend Rest Controller method mentioned in the Zend Rest Router configuration. My questions are: Do you...

HABTM-Relation : Create a relation for all other records

Hi! If i want to add a record to TABLE A, is there an efficient way to add a record in the JOIN TABLE for many (or all) records in TABLE B? I try to build a simple task management (in CakePHP). An user adds a task and there will be added a connection to each other user in the same group as the current user. At the moment, I use th...

ASP.NET MVC: returning plaintext file to download from controller method

Consider the need to return a plain-text file from a controller method back to the caller. The idea is to have the file downloaded, rather than viewed as plaintext in the browser. I have the following method, and it works as expected. The file is presented to the browser for download, and the file is populated with the string. I'd lik...

Zend Framework ErrorController not working on live site?

My site is set up pretty much as per the Zend Quickstart guide. The default ErrorController works locally using MAMP. But now I've deployed it to my live site I get a blank page and a "500 Internal Server Error" according to FireBug when I go to an action that doesnt exist. On my local server I get a 404 and a nicely formatted error pa...

Proper design a Model-Controller in Cocoa?

Hi, I'm trying to design a simple Cocoa application and I would like to have a clear and easy to understand software architecture. Of course, I'm using a basic MVC design and my question concerns the Model layer. For my application, the Model represents data fetched on the Internet with a XML-RPC API. I'm planning to use Core Data to re...

MVC (PHP): Do Controllers/Actions map to each and every request?

I've been getting to grips with MVC (in PHP) by way of Zend. My understanding of the Zend Framework is that each type of user request maps to a specific controller (which in turn may or may not map to a model), and each action maps to a view. I've noticed the same pattern in Codeigniter and Kohana, and to some extent also in Symfony. Eff...

can I have a controller associated with a partial?

In rails, page templates have their own controller which is called before a page is rendered (I think?). Likewise, can I have a controller associated with a partial that is called before the partial is rendered? I know you can pass local variable into a partial, but I want to run a good few lines of code to assign those local variable...

map.resource and naming convention for singleton

Hello, I am relatively new to ruby on rails, so this question might be easy. Rails does a lot of magic and I am not sure where to look up such things, because I don't know which part of the framework is to blame. I basically did the authlogic_example and fiddled around with the code afterwards. My routes.rb looks like this map.root ...

How to obtain current action from within model in RoR?

I found some information to get action_name within the controller, but I need to know what it is inside my model. I'm kind of second guessing myself and wondering if that's at all something you would need or could get from being within the model, but I'm not sure. Please let me know if there's a way to get something like action_name with...

Is it possible to pass classes between controllers in ASP.NET MVC?

Is it possible to do something like this in an ASP.NET MVC controller? public ActionResult Index(CustomADT adt) { ... } And you will pass in a class from another controller when you click on a link. Or is it only possible to pass around strings? Edit: A bit more elaboration. Let's say I have the following class hierarchy: publi...

Grails, getting InputStream from Controller (or even Servlet)

I'm trying to get inputStream from request, but it's always empty. Any idea how to get the contents of it? I'm trying to make a DataInputStream from it. ...

Accessing methods from another CakePHP controller, or better alternative!

I am creating an 'award' system for my website to encourage a community fealing, much in the same way that stack overflow uses badges. The site is built in CakePHP, i have created an Award model, controller etc - currently the methods for calculating whether a user has an award are contained within the Award controller. However, i can'...

Variable that's accessible to anything in the controller in Rails

I don't know if this is bad form or not, but I needed to set a file path that's accessible to all objects within actions in my controller. One action in the controller creates a file and stores it in a path. Another action serves the file using send_file. The only place I have been storing variables is along with an object in the model. ...

Is it acceptable to use role based controllers in a MVC framework

If my site has several user roles say Admin, User, Manager and there are several modules of functionality that may be used by one particular user or by all users how should I go about naming my controllers? Is it OK to have role based controllers such as an Admin, User and Manager controller as well as controllers for shared functionali...