controller

Multiple controllers in CakePHP

Hi, I m new to cakephp... I m developing an app using CakePhp and Mysql. In Cakephp i am having two tables one is Form (id ,name,created , modified) and attributes (id, Attribute-name ,form_id ,value) I kept everything in only one controller that is in forms controller.Within this formsctrller , i m having actions...

How can you use Controller A to access table B (in the same database)?

I have a "jobs" model in my RoR project and i need the controller to access a table other than "jobs" in the database. Calling: @var = Job.find(:all) is not problem, but calling @var = TableB.find(:all) gets "undefined local variable or method `tableB'" for JobsController:Class Any ideas? Thanks! ...

Returning from rails controller

Hi all, here's a beginner rails question... After I do: format.xml { head: ok} How do I return from the controller endpoint without showing the view? If I drop off the end of the function at this point, I get what I expect, but if I call 'return', I end up in the view (or in my case in a missing view template). I can code up lots...

ASP.NET MVC - Set ViewData for masterpage in base controller

I'm using a masterpage in my ASP.NET MVC project. This masterpage expects some ViewData to be present, which displays this on every page. If I don't set this ViewData key in my controllers, I get an error that it can't find it. However, I don't want to set the ViewData in every controller (I don't want to say ViewData["foo"] = GetFoo();...

Cocoa Controllers - best practice for notifying on completion, for disposal?

A general question on style and best practices... I have an ObjC controller object. After alloc/init of the object, I get it to do a job asynchronously: [myObject doSomeThingsOverTime]; The method sets things in motion, and then returns immediately. Question: what is the best way to be notified of the result in the future, so that I...

set zend framework action controller

hi all, i want to set my action controller from within a hidden filed in my view script form and when my form submitted zend framework router diagnose the action. like this: ...

How can I access the entire query string in an ASP.net controller action

I know that if I have an url like XController/Action?id=1, and an action method void Action(int id) the id parameter will automatically read from the query string. But how can I access the entire query string when I don't in advance know the name of all parameters. E.g: void Action(QueryStringCollection coll) { object id = coll...

Sending Multiple Items to MVC Controller via jQuery.Ajax

If youa are serializing a form using something like jQuery, it will often map the JSON keys and values to the properties of a object on the Controller Action you are posting to. So: jQuery: function PostForm() { $.ajax({ url: "/Home/TestMVC", type: "POST", dataType: "application/JSON", data: $('#for...

Using Castle Windsor to inject IRailsEngineContext

Issue I am using Castle Windsor as an IoC container in a Castle Monorail project. I would like to inject the current instance of IRailsEngineContext into an object being resolved from the container in a controller. Context The object I would like inject the rails context into would be used to wrap the session object for the purpose...

Creating the ASP.NET MVC Controller in Visual Studio 2008

I was running through the Movie Database MVC example on ASP.net. For some reason, when I right click the controller folder in Visual Studio solution explorer, I don't get the controller option from the add menu. I have Visual Studio 2008 SP1 and using .net 3.5. Any ideas why the controller option is missing? ...

One controller rendering using another controller's views

I have QuestionController I now have AnotherQuestionController with actions which should render using templates and partials in app/views/question/ Is this possible? Seems like it should be. I've tried render :template => "question/answer" but answer.html.erb includes partials and I get errors like "Missing template another_questi...

Overriding my controller, which event should I check for a cookie in?

Hi, in my .net mvc application, I am overriding the Controller class and creating my own that I will inherit from for all my controllers. Which event should I check for a cookie in? Does OnActionExecuting make sense? I tried OnActionExecuting, but can't seem to find the cookie collection? HttpCookie myCookie = ???????????? ...

How can I use mock models in AuthLogic controller specs?

I am trying to write specs for a controller without using fixtures (instead employing mock models). This controller requires a user to be logged in, for which I'm employing AuthLogic, following the author's recommendations. describe UsersController do def mock_user(stubs={}) @mock_user ||= mock_model(User, stubs) end context...

(Rails) Architecting a multi-model controller and index view...?

Hi All, I'm currently managing multiple models from a single SITE MANAGER page. I have the following relationships: Sites -> Buildings -> Meters -> Values Beside each "Sites" item I have "Edit | Delete | Add Building" Beside each "Building" item I have "Edit | Delete | Add Meter" Beside each "Meter" item I have "Edit | Delete | Add ...

How would I reference a global variable in my UIView ?

I have a UIView which is accessed by two different View Controllers. Whenever the user presses a button through the view controllers, I increment/decrement a shared variable like: -(void) viewWillAppear:(BOOL)animated { [[self appDelegate] sharedData].count++; } The shared variable gets created and initialized in the app delega...

ASP.Net MVC: File Structure, Controllers, and Views: How do I separate admin from rest?

Basically how can I get this: sitename/Admin/Forum/Index versus sitename/Forum/Index Background: To learn MVC I've taken on creating a cheesy forum application. Before knowing anything about MVC I just jumped right in with the default director structure, basically this: Now all these controllers/views deal with admin side things. ...

What is wrong when I get "Internal Server Error" returned from a jquery $.ajax call on an ASP.NET MVC project?

Here is my ajax call: response = $.ajax({ type: "POST", url: "/Row/getRowName", dataType: "json", data:({ currRow : rowName, offset : 5 }), error:function(request){alert(request.statusText)}, success:function(result){alert(result)} }).responseText; I get I...

How are you able to Unit Test your controllers without an IoC container?

I'm starting to get into Unit Testing, Dependancy Injection and all that jazz while constructing my latest ASP.NET MVC project. I'm to the point now where I would like to Unit Test my Controllers and I'm having difficulty figuring out how to appropriately do this without an IoC container. Take for example a simple controller: public c...

Is the front controller responsible for deciding which controllers/modules to load?

Hi, I am working on a website script, and currently I have a front controller, which determines what to load (e.g. what modules/extensions and controllers) based on the URI. Is this a good approach? I'm using PHP if that matters. I'm just wondering if that's not the front controller's job... ...

System.Web.UI.Page won't let me access CurrentUser or User.Identity from a Controller in ASP.Net-MVC

When I try user = System.Web.UI.Page.CurrentUser or user = System.Web.UI.Page.User.Identity I get an error saying that the method is not defined for System.Web.UI.Page... I am trying to access it within a Controller, does that matter? I've checked to make sure that I do not have another class named Page, Why would it say the metho...