controller

Rails controllers not working

Hi Guys, I've just started on rails, got it all setup on my DreamHost account with Passenger, except the demo controller I've created isn't working. I ran: $ script/generate controller demo index The files are all there, but when I go to http://rails.mysite.com/demo/index I get the 'We're sorry, but something went wrong' message. The...

How to add a view for the json result in asp.net mvc?

I returned json result from a controller but how can i add a view that uses this json result.. public class MaterialsController : Controller { ConstructionRepository consRepository = new ConstructionRepository(); public JsonResult Index() { var materials = consRepository.FindAllMaterials().AsQueryable(); r...

JSON output of a view in Grails

Ok, I have a very simple app created in Grails. I have a generated domain class (Person) and its generated controller, using the automatic Grails scaffold: package contacts class PersonController { def scaffold = Person } Now I'd like to get a JSON representation of a Person object. Do I have to change the view or the controll...

Unit testing in Web2py

I'm following the instructions from this post but cannot get my methods recognized globally. The error message: ERROR: test_suggest_performer (__builtin__.TestSearch) ---------------------------------------------------------------------- Traceback (most recent call last): File "applications/myapp/tests/test_search.py", line 24, in t...

Is this a valid jquery getJSON call?

I am using jquery getJSON with asp.net mvc controller... I cant able to get it work.... public JsonResult GetMaterials(int currentPage,int pageSize) { var materials = consRepository.FindAllMaterials().AsQueryable(); var results = new PagedList<MaterialsObj>(materials, currentPage-1, pageSize); return Json(results); } and ...

Return Multiple Objects Using ASP.NET MVC'S JsonResult Class....

Is it possible to Multiple Objects Using ASP.NET MVC'S JsonResult Class.... Here is a controller method which returns json object of my records but i also want to pass the count value.... var materials = consRepository.FindAllMaterials().AsQueryable(); var count = materials.Count(); var results = new PagedList<MaterialsObj>(materials, c...

Is this valid data for jquery ajax call to aspnet mvc controller?

I am using jquery with asp.net mvc.... Is my data option valid or am i missing some thing... $.ajax({ type:"POST", url: "Materials/GetRecords", data: "{'currentPage':1,'pageSize':5}", Any suggestion.... EDIT: I am calling a function from a view page, <asp:Content ID="Content2" ContentPlaceHolderI...

Spring MVC Table selected row

Hi, in a Spring MVC 2.5 application i'm using a spring <form:form> component and in this form a table with c:forEach is rendered. In each row a submit button is placed in. If i start a submit by clicking a button i would like to knwo, which button has processed the submit. <form:form commandName="formObject"> <table class="data-table"...

How to display invalid call exceptions from fluent controller in MVCContrib?

How can I pass the exception thorwn by the action in MVCContrib.FluentController CheckValidCall(action)? [ExportModelStateToTempData] public ActionResult Index(int itemId, int page) { return CheckValidCall(() => MyService.GetResults(itemId, page)) .Valid(x => View(x)) .Invalid(() => RedirectT...

Switching between 2 UINavigationControllers

Hi all, I seem to have a problem switching between 2 UINavigationControllers, i.e. one which controls the main (selection) menu of my application, and the second which controls the main session (i.e. the user can't go back to the selection menu once they're started a new session). The first works just fine, but I get into trouble when...

PHP: MVC and DRY

Hello! Question about controllers. Can controller call it`s own class methods inside an action? EDIT: Oh sorry. I meant I dont want to repeat myself. :) ...

What data (if any) persists across web-requests in Ruby on Rails?

I decided to use the singleton design pattern while creating a view helper class. This got me thinking; will the singleton instance survive across requests? This led to another question, Which variables (if any) survive across web requests and does that change depending on deployment? (Fastcgi, Mongrel, Passenger, ...) I know that Con...

Rails controller method going to plural form

I'm new to rails! Ok, I am trying to set up a user signup form. It is mapped as a singular resource in the routes map.resource :user And trying to create the user through the console works fine. the controller code for user's signup is as follows: def signup @user = User.new#(params[:user]) end def create @user = User.n...

CakePHP Auth how to allow specific controller and actions

I have a "Posts" and a "Users" controller. I use the Auth Component and I want that all users can visit "Post.index" but only logged in users can visit "User.index". In my app_controller.php I have this $this->Auth->allow('signup', 'confirm', 'index'); but with that all users can visit post.index and user.index. How can I specify a ...

How to get an array of all controllers in a Codeigniter project ?

I'd like to obtain a list of all controllers in a Codeiginiter project so I can easily loop through each of them and add defined routes. I can't seem to find a method that will give me what I'm after ? Here is the code snippet from the routes.php file where I would like to access the array: - // I'd like $controllers to be dynamically...

iPhone: Is is possible to determine wheteher ViewController is presented as Modal?

Is it possible to check inside ViewController class that it is presented as modal view controller? ...

How to automatically set and attribute to controller

Maybe the question is not self-explanatory, so I will explain it through. The deal is: I got the variable $conn in the bootstrap class file. I'd like to make it global for every controller so that I just have to call $this->conn in the controller action scope in order to access the data inside. How would I do it? Thx ...

Rails: getting logic to run at end of request, regardless of filter chain aborts?

Is there a reliable mechanism discussed in rails documentation for calling a function at the end of the request, regardless of filter chain aborts? It's not after filters, because after filters don't get called if any prior filter redirected or rendered. For context, I'm trying to put some structured profiling/reporting information int...

Controller class not available in Add View ASP.NET MVC

Hi I have created the following controller i want to add view that should have the data access class UserMagnament.Controller.menuitems but when i add view by right clicking on view folder,it is not showing "UserMagnament.Controller.menuitems" in add data class using System; using System.Collections.Generic; using System.Linq; using Sy...

MVC - dispose resource in controller

Hi folks, What's the proper way of disposing resources when a method in the controller returns filestream or file or filecontentresult objects ? For ex when doing something like below: using CrystalDecisions.CrystalReports.Engine; public ActionResult Report() { ReportClass rptH = new ReportClass(); rptH.FileName = Server....