ok here's some code:
prompt>rails my_app
prompt>cd my_app
prompt>script/generate scaffold service_type title:string time_allotment:integer
prompt>rake db:migrate
then edit these files to look like this:
#routes.rb:
ActionController::Routing::Routes.draw do |map|
map.resources :services, :controller => :service_types
map.connect '...
I have an NSTableView which is bound to an NSDictionaryController. I have set this and the content dictionary through the interface builder. The question I have is, how do I add objects to the dictionary in a manner that the controller will see it automatically and display it in the table.
I've seen in examples about NSArrayController...
Thus far worked with asp.net mvc1 and just started with asp.net mvc2..... what are good candidates for executing a controller asynchronously? Should i use it for long running process or some background processing? What are the pros and cons choosing asynchronous controller in asp.net mvc 2? Any suggestion...
...
Here's the scenaio, I have an Employee object and a Company object which has a list of employees.
I have Company.aspx which inherits from ViewPage<Company>.
In Company.aspx I call
Html.DisplayFor(m => m.Employees).
I have an Employee.ascx partial view which inherits from ViewUserControl<Employee> in my DisplayTemplates folder.
Eve...
Hi, using ASP.NET MVC 2 I have a navigation menu inside my Master Page. In the navigation menu, I am trying add a class to the that the current page relates to (i.e., home page will add class="active" to the Home button). I'm trying to consider scalability and the fact that I don't want to change individual pages if the navigation chang...
I posted a question awhile ago asking how I could limit the rate at which a form could be submitted from a rails application. I was helped by a very patient user and their solution works great. The code was for my comments controller, and now I find myself wanting to add this functionality to another controller, my Messages controller. I...
I have a standard query that gets the current user object:
@user = User.find_by_email(session[:email])
but I'm putting it as the first line in every single controller action which is obviously not the best way to do this. What is the best way to refactor this?
Do I put this as a method in the Application controller (and if so, can y...
Hi everyone,
I have a three-table system: Companies, Customers, and Matches. The matches include, for example, private notes that each party makes about the other and some options they can set regarding the other.
I have two sets of views centered around Companies and Customers for each party to look at the other and modify their notes...
I have a model called Contact_Email. When an Email template is sent through ActionMailer to a specific Contact, as part of the Create action it sends it through upon .save.
However, I want to create a "skip" action which also creates a Contact_Email, but does NOT send an ActionMailer and allows me to set the status differently.
I want...
Hi guys,
Quick question. Here is my code:
#routes
map.resources :customers, :has_many => [:addresses, :matchings]
map.connect ":controller/:action/:id"
#url path:
http://127.0.0.1:3000/customers/index/3
#customers controller
def index
@customer = Customer.find(params[:id])
end
#customers view/index.html.erb
...
<%= @customer.name ...
I'm about to do a PHP website using the MVC pattern. I am not using a framework as the site is fairly simple and I feel that this will give me a good opportunity to learn about the pattern directly. I have a couple questions.
Question 1: How should I organize my views? I'm thinking of having a Page view which will have the header and fo...
I have a controller method like such:
def search = {
def query = params.query
...
render results as JSON
}
How do I unit test this? Specifically, how do I call search to set params.query, and how do I test the results of the method render? Is there a way to mock the render method, perhaps?
...
Hi all,
I have a split View controller ,in which the left side holds a table view controller. Can any1 pls help me, if I wnt to show an action sheet inside the popover , when I click on the detail disclosure button of the table cell ?
Best Regards.
...
Hey All,
I'm new to JSF and am trying to make a content controller. Basically whenever someone makes a request to www.myapp.com/external/** I'd like to forward to a controller that pulls external content into a page template and spits it out to the user.
For example /external/test/test.html might pull in content from a location XXYYZZ...
I've got this in my controller:
[HttpPost]
public void UpdateLanguagePreference(string languageTag)
{
if (string.IsNullOrEmpty(languageTag))
{
throw new ArgumentNullException("languageTag");
}
...
}
And have this jQuery code POSTing to the controller:
jQuery.ajax...
I am very new to CodeIgniter, but have been programming PHP for ages. I'm writing some software at the moment and using CI for the first time with it.
The default controller is set to the first controller I want to action call 'login' (the controller is login.php, the view is login.php. When the form is submitted it calls the 'authent...
im developing a web application, using multiple pages, each with their own controller.
The problem now is that there are some variables in a controller, created for one page, that are required for an other page ( with a different controller).
Therefor i need to load one controller into the other one.
I did this by adding
App::impor...
I have a number of .js files that I would like to be stored in the same directories as their views (they're specific to a view - its simply to keep the javascript separate from the view's HTML)
However, adding them to the /Views/ControllerName/ directory wont work because when a request is made to the webserver for the .js file:
<scrip...
I want to add a new user to the database, and do so by making them fill in a form and submitting this. All seems to work fine. Just before my save() call in the controller I return all data and all necessary data is there. It is valid(ated), since no errors are returned.
But then nothing happens. I'm being returned to my form without a...
y is it so hard to extract the date from the view via the params in a grails controller?
i don't want to extract the date by hand like this:
instance.dateX = parseDate(params["dateX_value"])//parseDate is from my helper class
i just want to use instance.properties = params you know :)
in the model the type is java.util.Date and in th...