controller

PHPUnit - test MVC controller with $_POST variable

I'm starting work with PHPUnit with Kohana. My application have many controllers which simply takes data from some form, validates and inserts/updates/deletes into/-/from database. How should I write a test cases for that. I know that if I want to test a function I write data provider function and just compare returned value with the ex...

Using parameter to control Rails validations

I have an Event model with a finish_time field and a form checkbox called whenever. When whenever is checked I want to set finish_time to nil regardless of its value in parameters, when whenever is not checked I want to make sure that finish_time is a valid date before I save it in the database. Currently I am achieving this using a w...

Cakephp - Updating information on a logged User

Hello, I have a controller named sales_controller at this controller I got a function in wich I want to: update information about the sale -> DONE create a new record on other model -> DONE update a field on a user record -> PROBLEM My last attempted to do this was: App::import('model','User'); $user= $this->Auth->user(); $nr = $t...

Invoke Action Method from Clicking a button in ASP.NET MVC

I want to know if I can call a method in the controller when a button is clicked. I have a view called home and when the view is loaded, it invokes the Index action method in the controller. I have a Button (HTML or ASP.NET) called LoadData. When I click the button, I need to load some data in the same view called Home. How do I do th...

Hide iFrames Using the Controller

Hi, I have tried finding the answer to this and come across several things which have not yielded the desired result. So I wrote a HTML Helper that loads in an (fancybox) iFrame: <%= Html.ActionFrame("Projects", "Edit") %> The resulting page has a save button which currently saves the data and redirects to the Index page within the iFr...

Different behavior for the same controller action in Rails

Say, I have this in one of the controllers: def show case current_user.role when 'manager' render :text => 'Manager view!' when 'admin' render :text => 'Admin view!' end end The thing is, that instead of 'render', of course, there's a bunch of code and it all stops look pretty very fast. Also, I h...

Navigation controller autorotation

Hi! I'm trying to find the answer and cannot believe that this problem is not widely and clearly explained. It's a quick question. Navigation based application, two view controllers, I want to autorotate my interface to landscape/portrait whenever used rotate his device. Autorotation works when 1st view controller is displayed. 2nd vi...

ASP.NET MVC - How To Refresh View From Actionmethod as a response to request?

Hello, I have an action-method in a controller that takes requests coming from a variety of different views. It is somewhat of a utility method and I simply want it to accept the parameters it is given - do something - and then refresh the view that sent the request. Right now, the only way I see to do this is by having the method fig...

Kohana controller URI basics

Re: Kohana v2.3.4. Do I have to create a new controller for every URL which uses segment 2? In other words, if I want my URLs to be: www.example.com/foo www.example.com/bar ... do I need to create a unique controller for foo and a unique controller for bar? I'd like to create just one controller, if possible. EDIT: I'd like to avo...

POST in PHP MVC Controller?

Hello All, I am learning the PHP MVC pattern for my backend implementation. Looking at this excellent example: Implementing MVC in PHP: The Controller http://onlamp.com/pub/a/php/2005/11/03/mvc%5Fcontroller.html I feel comfortable with the execution flow in a GET. But there is no mentioning of what happens in a POST. What would the t...

How to Kohana global variables for all controllers?

EDIT: Kohana 2.3.4 Is the proper way to make a few variables available to all my controllers to add a MY_Controller.php file in my /application/libraries/ folder (shown in the docs here)? Are there any better ways to do it, or is this the only recommended method? Being new to OOP, can you link me to any examples? EDIT 2: I've heard ...

Proper way to structure classes in Xcode framework

I'm building a custom Xcode framework, and I have a class called AXController that has a class method called showActivationWindow. showActivationWindow initializes and shows a window using AXWindowController which is a subclass of NSWindowController. Then, AXWindowController calls activate which is a class method in AXController on a but...

Passing parameterized list to view in MVC using Entity Framework

In a MVC project am trying to create a view which has the Title from a parent table and the subsequent list below it from its related Child table. I pulled the tables into the project using Entity Framework and in the controllers namespace created the follwing Viewmodel: public class ServicesViewModel { public ServicesViewModel(Lis...

ControllerFactory Help please

I recently followed Stephen Walther through creating a generic repository for your data models using the Entity Framework with the following link, http://bit.ly/7BoMjT In this blog he briefly talks about creating a generic repository and why it's suggested to do so (to be clear of friction). The blog itself doesn't go into great detail...

Rails action caching with querystring parameters

How can I cache my REST controller with Rails where my actions have query string parameters? Example: GET /products/all.xml?max_price=200 Thx! ...

Rendering view of controller in another controller in Rails

The same question has been asked many times, but I am unable to find a solution that works for me. I have three models, posts, users, and picture (paperclip). I use restful_authentication and set it up so that each user sees only his/her post in posts/index. I've also given him the ability to upload a profile picture. My question is h...

Count records returned in a search - ROR

I'm trying to get Rails to return a count of the records returned in a search (search results found); I can get Rails to count the total amount of records using Inventory.count However when I enter @advsearch.count it blows up. Any ideas? The code below is my controller: def new @advsearch = Advsearch.new end def creat...

Argh! Why does System.Web.Mvc.HandleErrorInfo get passed to my views?

I'm experiencing a rather frustrating problem. My MVC site runs fine for the most part, but randomly throws an error (which shows a friendly error to the user). When I check the logs, this is what I get: System.InvalidOperationException: The model item passed into the dictionary is of type 'System.Web.Mvc.HandleErrorInfo' but this dicti...

Best practice to set/get information about whether user is logged in or not.

I know similar questions have been posed before, but I could not find a duplicate that handles ASP.NET MVC (and the controller aspect) specifically. My question is as follows: In a MVC model, my understanding is that the controller should handle the use of HttpContext to determine who is logged on, if any. This is so the controller can...

Trying to make a CodeIgniter controller called "List"

Hi I have the following code in controllers/list.php: <?php class List extends Controller { function index() { echo "hi"; } } ?> However, trying to access it gives me the following PHP error: Parse error: syntax error, unexpected T_LIST, expecting T_STRING in /var/www/whimventory/htdocs/system/application/contro...