Please see UPDATES at the bottom of the question...
For reference, this problem evolved out of some fixes I made based on a previous problem I was having here: http://stackoverflow.com/questions/1298846/associating-two-models-in-rails-user-and-profile
I'm building an app that has a user model and a profile model.
I want to associate t...
Hi,
I have the following query which id like to sorty by "raceDate" and by "raceNo" asc. I can figure out how to sort by one field, but not by two, any ideas?
def list = {
params.max = Math.min( params.max ? params.max.toInteger() : 20, 100)
params.offset = params?.offset?.toInteger() ?: 0
params.sort = "raceDate"
...
I'm using Asp.net MVC 1 and I would really like my controller actions to use StronglyTyped View(data) calls that enforce type checking at compile time and still let me use aspx pages under the default view engine. The ViewPages I call are strongly typed, but errors in the action's call to View(data) can't be caught at compile time becau...
I'm not sure if this question is non-sense or not, please tell me if so. I am wondering do I create my models like one per each table in my database, or do you do one per controller? Is there something I am missing here?
From what I read the Model is suppose to be a representation of the real business objects, so would I just want to ma...
What is the best way to determine which Controller class a Kohana application is presently using?
Examples:
http://sitesite.com/ - _defaultControllerName_
http://somesite.com/frontpage/articles - "frontpage"
http://somesite.com/contact/ - "contact"
...
My question is about how to access the TabBarController from within one of its viewControllers.
Imagine a mainClass.m that adds tabBarController which has two viewControllers - viewController1 and viewController2.
In viewController1.m there is a game. When the game is over, viewController1.m wants to tell tabBarController to displ...
My question is: How do I make the edit/update methods for my profiles controller stop creating new records when I edit a profile page?
I have a user model and profile model.
user has_one :profile.
profile belongs_to :user.
My routes.rb looks like this: map.resources :users, :has_one => :profile
When a visitor to my app creates a use...
I built a basic search form that queries one column in one table of my app. I followed episode 37 Railscast: http://railscasts.com/episodes/37-simple-search-form. Note I just posted another search related question, but it's on a completely different issue.
In my app, the search queries the zip code column of my profile table, and retur...
In my Controller in a Asp.net MVC 1 app I want to use UpdateModel to populate a variable with POST data in my controller. I've looked at dozens of examples but even the most basic ones seem to fail silently for me.
Here's a very basic example that's just not working.
What am I doing wrong?
public class TestInfo
{
pub...
This is what my data model classes look like:
public class Employee
{
public string FirstName { get; set; }
public string LastName { get; set; }
public Position Position { get; set; }
}
public class Position
{
public string Title { get; set; }
}
I have a Create view where I want to have two text boxes for first name a...
Under what exact circumstances do @SessionAttributes get cleared? I've discovered some confusing behaviour when trying to use two models in a page.
When I do a GET followed by a POST using this controller...
@Controller
@RequestMapping("/myPage*")
@SessionAttributes(value = {"object1", "object2"})
public class MyController {
@Reque...
I'm having trouble navigating to a different controller view from another controller action.
e.g. return view("edit", "profile", profile);
I'm trying to navigate from the account controller to the edit view in the profile controller.
Any suggestions?
Thanks,
-Mike
...
I'm trying to test a very simple form that uses only a list and a create. This is the controller:
public class PositionsController : Controller
{
private readonly IPositionRepository _positions;
// default constructor
public PositionsController()
{
_positions = new TestPositionRepository();
}
// DI cons...
In my Rails controller I want to branch to a different controller's action, show its view and then return back to my original action, i.e. it's not a simple redirect, more like a sub-procedure call.
I want to use this whenever a user does something suspicious, like editing a post too often in a row. I still want to allow the edit, but f...
Hi friends,
I am currently doing an iphone application in which i need to include a navigation controller in my 3rd view. there are tutorials for navigation controller but its in the first view itself. When i include it in the third view the view is not loading. can anyone help me please...
Shibin
...
I have a question regarding keeping the controller and view separate. It seems to me that the controller should only pass a model to the view, and the view decides how to display the model. This way, the controller and model stay separate and can be independently developed. However, a lot of tutorials I see online and even in the book Pr...
I followed these tutorials:
http://www.asp.net/learn/mvc/tutorial-39-cs.aspx
http://schotime.net/blog/index.php/2009/03/31/integrating-xval-validation-with-linq-to-sql/
in order to enforce data validation using Data Annotation for a LINQ-To-SQL-generated class. The metadata class looks like this:
[MetadataType(typeof(PositionValidatio...
I'm pretty new to iPhone development and I'm still getting my head around Objective-C, so please bear with me :)
I am trying to change the text of a label from inside an object that belongs to the main view controller. Umm. I think that sounds right.
For those of you familiar with the AQRecorder class from the SpeakHere example on the ...
This is very similar to another recent question:
http://stackoverflow.com/questions/362514/asp-net-mvc-current-action
However, I want to get the name of the current action from within controller code.
So within the code of a function that's being called by an Action, I want to get a string of the name of the current Action.
Is this p...
Hi Guys,
How do you specify a custom view script for a given Controller Action method?
For example:
Class UserGalleryController extends Zend_Controller_Action
{
public function fooAction()
{
$this->view->actionMsg = 'foo';
// (uses foo.phtml automagically)
}
public function barAction()
{
$this->view->actionMsg = 'bar';...