controller

Complex Forms in rails (has_and_belongs_to_many)

Hello all - Right now, I'm in the middle of actually building a Project Management application, and I'm kind-of stuck on the way i should build this form. At the moment of adding a project I would like to select the clients that would be included in the project. Here's the code to a few things of interest: Project Model Project Migrati...

What's the correct place to share application logic in CakePHP?

I guess simple answer to the question would be a component. Although I agree, I feel weird having to write a component for something so specific. For example, let's say I have a table of users. When a user is created, it should form a chain reaction of events, initiating different kinds of data related to the user all around the databa...

Cocoa - calling a VIEW method from the CONTROLLER

Hello everyone, Got a little problem i asked about it before but maybe i didnt ask properly. I have a cocoa application, which amongst other things, must do the following task: - load some images from the disk, store them in an array and display them in a custom view. In the Interface Builder i have a CustomView and an OBJECT that poin...

How to define route & controller structure for 2 controllers?

I want to create an MVC app to generate factsheets, but I'm not sure how to structure the routing and controllers. It consists of an index page, which acts as a template for the layout of a number of independent panels, each of which contains different types of data. I want to have a the route template like the following: /Factsheets/...

How do I use Rhino.Mocks to mock a ControllerContext

I am trying to use Rhino.Mocks to mock up a ControllerContext object to gain access to runtime objects like User, Request, Response, and Session in my controller unit tests. I've written the below method in an attempt to mock up a controller. private TestController CreateTestControllerAs(string userName) { var mock = MockRepository....

How to make Interface available in all Controllers?

I have a number of Controllers, and I want them all to have an interface to a PageConfiguration object that needs to be created based on the URL. I'm not sure how to do this other than to create the interface in the action methods, because they have access to Request.QueryString, where the Controllers constructors don't. Do I need to cre...

Is it possible for a Master page to access Controller properties?

I need to load a HTML wrapper dynamically depending on data that gets populated in the PageController, which is a base class that all other controllers implement. This is the PageController: public class PageController : Controller { protected PageConfiguration PageConfiguration; public string WrapperTop { get; set; } publ...

Can Spring Security use @PreAuthorize on Spring controllers methods?

Can Spring Security use @PreAuthorize on Spring controllers methods? ...

To achieve basic code coverage what tests should I run against an ASP.NET MVC Controller?

My controllers are utilizing StructureMap and AutoMapper. Presently, there is nothing exceptional with my routes. For the basic CRUD controller actions what tests should I be writing to ensure good code coverage? ...

How to get Controller name, and data avalible in a base Controller?

I have 2 questions. First, background: I have a PageController : Controller and SearchController : PageController PageController is defined as: public class PageController : Controller { protected ISite Site; protected PageConfiguration PageConfiguration; protected override void Initialize(RequestContext rc) { ...

Can someone help me Mock this ASP.NET MVC Controller with Moq, please?

Hi folks, I'm trying to mock an ASP.NET MVC2 Controller using Moq but I get an error because i'm trying to mock an non-overridable property. How should I be doing this, please? NOTE: the controller I'm trying to mock up is the (abstract) ASP.NET MVC2 Controller ... not a custom controller. Why? I'm trying to test some custom controller...

passing checkbox and textbox values from a view form to a controller action

Hello, I have a view with a form..this form has a textbox and a checkbox in it. i also have a submit button in the form which points to an action in a controller. my question is..how can i pass the values in the textboxes and the checked state of the checkboxes to the controller action? the textboxes and checkboxes are not tied to a ...

Rails: Difference between List and Index

I appreciate this is an incredibly noob question, but having Googled multiple combinations of search terms I regretfully am still in the dark. These things can be difficult when one doesn't know and so obvious when one does. I have semi-home page where incoming customers can choose to see a queried list or do a handful of other things. ...

Managing conditional redirect_to in Rails

I have multiple user types in a system that shows each user different views and templates of the stored information, often based on whether they are logged in and what current_user.user_type is. As a result, I have lots of this: #controller @project = Project.find(params[:id]) if current_user.user_type == "Company" redirect_to :contro...

Html.BeginForm in partial for a different controller

I have the following code: <% using (Html.BeginForm("AddComment", "Comments", FormMethod.Post)) { %> <div id="New_Comment"> <textarea name="newComment" id="newComment">Add comments</textarea> <input type="submit" value="Add" /> <div><span class="text_grey">Attach:</span><a href="#" class="link_text_grey">File</a> <a href="#" class="link...

Tracking page referrer on first page view of a visitor in rails app

Hi, I want to be able to read the referrer of visitors coming from certain domains when they come to any subpage of a rails app. How would I handle that before the controllers come into play ? (I want a general solution for alle pages, not to check it on every single controller) Any hints appreciated. ...

Understanding folder "image" as a controller

When I try to access the url http://localhost/mysite/public/images/grey-arrow.gif in a controller in my application I get the error: Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (images)' in C:\xampp\php\PEAR\Zend\Controller\Dispatcher\Standard.php:242 Stack trace: #0 ...

What are some alternatives to RedirectToAction?

On my HomeController I have an index action which redirects to the index action of the CustomerController via the RedirectToAction method. In this instance I don't like how RedirectToAction modifies the URL showing mysite.com/Customer. Are there some alternative mechanisms to performing a redirection that will allow me to still leverage ...

How to make the view simpler, the controller more useful?

This question relates to cleaning up the view and giving the controller more of the work. I have many cases in my project where I have nested variables being displayed in my view. For example: # controller @customers = Customer.find_all_by_active(true) render :layout => 'forms' # view <% @customers.each do |c| %> <%= c.name %> <% ...

Core data: can NSFetchedResultsController fetch two different entities?

I am working on an iPhone app, and in a particular view I need to load two different entities: One that will populate a UITableView, and another that will populate a UITextView. Is it possible to fetch both properties using a single NSFetchedResultsController? Or do I need to use two different NSFetchedResultsController? Any ideas on...