Controller provides a centralized entry point for handling requests. Usually is referred as a part of Model-View-Controller design pattern.
Questions tagged [controllers]
903 questions
0
votes
3 answers
Using variable names to instantiate a class
I'm trying to do something like this:
$controller = new $controller . 'Controller';
Which would create a new instance of the PagesController class if $controller was Pages. I'm getting this error, however:
Fatal error: Class 'Pages' not found in…

James Dawson
- 5,309
- 20
- 72
- 126
0
votes
1 answer
Change default controller path in lithium
I'm writing a new version of an API and would like to support legacy versions by having distinct sets of controllers for each version. Within the default "app\controllers" path in Lithium, I would like to have for example "v1" and "v2" paths.
I have…

Brent Scheffler
- 23
- 3
0
votes
1 answer
How to render an action and set the URL in Rails 3?
How to render :new and set the location to question/:id/new/answer?
render :location => new_question_path sets the location to question/:id/answer
render :location => "/question/#{params[:id]}/new/answer" did not work either.
Relevant route: get …

B Seven
- 44,484
- 66
- 240
- 385
0
votes
2 answers
Access model from another controller
We have a small mvc we have built, we want to access models from different controllers.
i.e
class Controller {
function A() {
}
}
class Search extends Controller {
function B() {
$this->model->doSomething();
}
}
class…

user1611626
- 1
- 1
0
votes
2 answers
Creating reference to another class, Objective C
In my first file I want to be able to get reference to my second file and change a property that it has, This is what I have. I made a class method to return the reference but the problem is I get a warning in the method, on top of that when I do…

Terrel Gibson
- 481
- 1
- 6
- 21
0
votes
1 answer
mvc two areas with same name in different project
I have a project with the following structure:
Solution
- CMS.core
---Areas
------Admin
---------Controllers
- Site.Web
---Areas
------Admin
---------Controllers
Everytime I try to route to a controller under site.web/areas/admin/controllers it…

KCWebMonkey
- 411
- 4
- 4
0
votes
1 answer
Calling instance Method from another controller objective C
I have two files and I am trying to pass some information between them. Basically I have a Boolean Property that I use to decide what part of a method I should use. I created an instance method that returns this boolean property for viewing. In my…

Terrel Gibson
- 481
- 1
- 6
- 21
0
votes
1 answer
Why form_tag is generating form with wrong url (No route matches [POST] "/assets")
I looked at some posts about this question, but I can't get how to solve this.
I have index page on which I have form which I will use to take them from params hash from it.
Here is form:
<%= form_tag(:action => '/show', :method => "get") do %>
…

Denys Medynskyi
- 2,353
- 8
- 39
- 70
0
votes
2 answers
Can't manage to organise function for associated models
I'm thinking about solving my problem and need some help.
I need to pay users, so I have page, where admin see all users and can pay each of them.
I have websites model, which is belong to user. Depends on some attribute from website model I should…

Denys Medynskyi
- 2,353
- 8
- 39
- 70
0
votes
2 answers
Class/Object Expected
I have this in my controller under the index action:
format.csv do
@coasters = Coaster.all
render text: @coasters.to_csv
end
But when I run it I get: undefined method `to_csv' for # I just can;t see where I am going wrong?
The to_csv…

rctneil
- 7,016
- 10
- 40
- 83
0
votes
0 answers
two controllers in a single .py file
I've been going through the reddit code and i noticed that they sometimes have two controller classes in a single py file.
eg:
api.py
contains:
class ApiminimalController
class ApiController
I was wondering how that is done. I tried it myself but…

hackawaye
- 1
- 1
- 4
0
votes
2 answers
MVC3 controllers and views
Okay so right now in my main controller class I just have each separate thing return a view like:
public ActionResult Contact()
{
return View();
}
I have this down pat, as it is not very difficult! What I would like to know…

Ethan Pieper
- 57
- 1
- 2
- 5
0
votes
1 answer
How to match fields in cakephp that are not present in database
How to match new_password and confirm_password fields when they are not in database?
Hi... I would like to know how I would be able to match my fields "new_password" and "confirm_password", they are not stored in database they are just used for…

sachinw
- 13
- 2
0
votes
1 answer
Calling a JavaScript function from a Rails Controller
The project I'm working on renders several pages (such as login pages and signup forms) as modals, which is accomplished by giving those links the class .modal so the following piece of JavaScript would trigger:
$('.modal').click(function(){
var…

Adam Templeton
- 4,467
- 7
- 27
- 39
0
votes
1 answer
How to avoid SQL injection in Rails 3
In my Controllers I'm using many find_by_sql() stuff, and to avoid SQL injection I'm building my SQL statements as hashes as follows
Beneficiary.find_by_sql(["SELECT * FROM beneficiaries WHERE project_id=? AND cso_id IN(SELECT user_id FROM…

Unknown Coder
- 1,510
- 2
- 28
- 56