controllers

How can I temp go to another view to create entities

Hi I am new to asp.net MVC and have to decide how I can implement the following. Can anybody please point me in the right direction I have a controller which serves a view to create customers which all works fine I have another controller which serves a vew to create invoices. But to create invoice I will need to search for customers w...

Using MvcSiteMapProvider to create menu

Hi. Sorry if this seems like a novice question. I'm trying to create a navigation menu that will be displayed in every page of my mvc site. I'm using MvcSiteMapProvider, and the general idea is to create a general ApplicationController, which every controller inherits. public abstract class ApplicationController : Controller { publ...

Is there any partial kind of thing for controllers in Ruby on Rails

I have a controller having more than 1000 lines of code. Right not I am doing Code review for this controller. I arrange my methods according to the module. Now I realise that my controller is not easy to maintain and so I want to something like following class UsersController < ApplicationController #Code to require files here ...

Cross controller function conventions for MVC web?

I have a question about the best practices of placing certain functions in controllers in an MVC web framework. Lets say I have a User & Tags controller. I have a function/method called addTag_to_user(). What is the conventions or best practices for placing this in either the Users or Tags controller? Though personally I am more incli...

Question about view controllers in the iPhone SDK

Hello. I will begin by saying that I'm 15 years old and from Sweden, so please excuse my English. I'm reading a book called Beginning iPhone 3 Developement - Exploring the iPhone SDK, by Dave Mark and Jeff LaMarche. I've read about navigation controllers and multiview applications, and now I want to create my own little app, a very simp...

When should functionality be made available in its own Controller?

I am working on a web application that has to present charts on different pages. Each page corresponds to a Controller, and each Controller that needs a chart has an interface to a ChartService. The service requests a chart from a third party vendor. It then returns an image wrapped up in some HTML with JavaScript as a string directly in...

accessing HttpContext.Request in a controller's constructor

I'm following this ASP.NET MVC tutorial from Microsoft: My code is slightly different, where I'm trying to access HttpContext.Request.IsAuthenticated in the controller's constructor. namespace SCE.Controllers.Application { public abstract class ApplicationController : Controller { public ApplicationController() ...

Adding a pages/main controller for 'brochure-site' section of a Rails app

I am developing a rails application that will eventually contain products, users, and orders. For now I am just trying to get their 'brochure site' up. Rather than build it twice I thought to simply start with the rails application making it easily to rapidly move on as they need. That said...I am looking for advice on the best way to bu...

Using friendly_id in a catch all route

Hi all, I want to be able to use friendly_id in a catch all route to render the page that it fetches. for example http://localhost:3000/business would render controller "pages" action"show" with id "business" without leaving the url above. The aim of this is to avoid things like localhost:3000/pages/business and make shorter urls. I ...

Best Practice to abstract ActiveRecord model queries in Rails?

I'd like to extract out logic from the controllers to somewhere that it can be more DRY. What's the best way of handling something like the following in Rails? For instance, as opposed to having the query in the controllers, I could place it in the model: class SmoothieBlender < ActiveRecord::Base belongs_to :user def self.get_...

doctrine2 zend framework namespaceing controllers

I'm trying to integrate the doctrine2 sandbox with a default Zend Framework App. When I try to use namespacing in the controller I get an 'Invalid controller class ("IndexController")' error This Works: use Entities\User, Entities\Address; class IndexController extends Zend_Controller_Action { ... } This does not (but should?): na...

Rails 3: @template variable inside controllers is nil

Hello guys! I have the same problem, as in this question. Did anybody find any solutions for this? So I can't do like this: flash[:notice] = "Successfully created #{@template.link_to('product', @product)}. or like this: @template.title("Page title is here.") It worked perfectly in Rails 2.3. The main idea is to find out, how to u...

UIActivity Indicator- load views

Hi, I am trying to add some titles to my project. So, when my app gets loaded it should show my title screen with activity indicator spinning and after 3seconds it should push the navigation controller. Basically I will have an image on the first view controller. So, in IB I added an image view and set the image. Please help me guys how...

How do I redirect to a specific action in a different controller in Rails 3?

I'm writing an API; in this API, I have a FruitBasket model which has Fruits. A particular Fruit may belong to more than one FruitBasket at a time. FruitBasket and Fruit are both ActiveRecord objects. If someone performs a GET on /fruit/100/baskets, I want to provide a JSON list of baskets which have that fruit, in the form of basket ID...

How do I make an edit users page work on my home page?

Complete rails novice and something just isn't clicking. On my home page /home - I use devise, so I have a check . <% if user_signed_in? %> <%= render "getting_started" %> <% else %> Welcome! <%= link_to "Sign up", new_user_registration_path%> <% end %> At the moment getting_started.html.erb has some instructions and then I'm di...

CAkePHP calling one controller action from a different controller

In my app, I want to add a user notification each time a user receives a comment on an image or other page. Therefore in my add action in my images controller, I'd like to also call the addNotifications action which is in my Notifications controller. I'm trying to stay away from requestAction based on the warnings, but is there another...

ASP.NET MVC Model contents disappears randomly.

Update following initial comments The model has an object in it called 'Account', of which there is an int propety (Account.AccountID) ViewB has a form which collects some additional information - but also has a textbox which is populated with Model.Account.AccountID. When I submit ViewB however, Model.Account becomes null. Its pro...

What's the best way to reverse communicate between view controllers?

I've been thinking about this and have read through another stackoverflow question regarding the best recommended way to communicate between view controllers. However, the question/answer for that doesn't seem to address the best approach for the reverse behavior. i.e. to pass data from ParentController to its ModalController, we could ...

In older versions of Rails, what are the methods to say, controller <--> view sharing methods?

I think in newer versions of Rails, there are ways to say, "share these methods between controllers and views" using something like controller.helper controller.helper_method (I am not sure if they are). But what if these methods are missing in older versions of Rails? How can you tell Rails to share methods between controllers and...