Questions tagged [controllers]

Controller provides a centralized entry point for handling requests. Usually is referred as a part of Model-View-Controller design pattern.

903 questions
8
votes
5 answers

codeigniter MY_Controller not found

i’m using the Codeigniter.2.1.3 for a website, so i need to extend the CI_Controller so i can add a method to be executed with all controllers so i did what’s in the user_guide: creating a file named MY_Controller.php in the application/core folder…
Yahya KACEM
  • 2,481
  • 7
  • 34
  • 61
7
votes
2 answers

Custom Devise controller

I would like to customize my registrations controller for Devise in Rails. I understand that you must create a controller like this: class AccountsController < Devise::SessionsController def create super end end Well, that's all very good.…
orion3
  • 9,797
  • 14
  • 67
  • 93
7
votes
2 answers

When should I create a separate controller instead of a custom action in Rails?

Consider an example where I have an Orders model. Triggering the index action shows all of the orders in the system. Now I want to have a separate page that displays a chart of all refunded orders and another page that displays all cancelled…
Rob Sobers
  • 20,737
  • 24
  • 82
  • 111
7
votes
2 answers

Rails 3.2.3 namespaced controllers being overridden by global controllers with same name

When the global application controller is loaded first, the namespaced application controller does not load when loading pages within that namespace. The application controller looks like this: class ApplicationController < ActionController::Base …
6
votes
1 answer

How can I override a Magento controller?

I need to check the validity of a coupon code on the checkout/cart page with server-side code. Magento already ships with a similar check in place. However, I need to add one to see if a user is connected or not: what would be the best way to…
JohnT
  • 967
  • 2
  • 16
  • 30
6
votes
3 answers

The controller with the name 'PokemonCtrl' is not registered

I am trying to add a controller to my Angularjs app. This is the first time I have set it up without using $scope as a dependency and used the routes to declare what controller I am using. What am I doing wrong where PokemonCtrl is not registered?…
DDelgro
  • 463
  • 1
  • 6
  • 16
6
votes
1 answer

Rails - Call same after_action method from different controllers

Upon sign in, I have my SessionsController run an after_action to reset certain user columns. In another controller, I want to do the same after_action on create and update. It's easy enough to just copy and paste the same code into both…
Raymond R
  • 1,350
  • 3
  • 12
  • 19
6
votes
1 answer

Binding.pry in controllers with passenger

I try use binding.pry in controller file and when i reload page, passenger stuck on it but irb doesn't work (It shows up, but stuck. It looks like passenger wrote string and thats all.). On passenger site we can read, that irb is for business plan…
6
votes
1 answer

How to handle header and footer with AngularJs

I'm very sorry If I don't explain myself very well, so here goes. Basically I'm having trouble trying to work this issue out. I am using Yeoman to generate my angular project. I have a header and footer, footer will be static and header will need…
Sananes
  • 131
  • 2
  • 9
6
votes
2 answers

How to render a view inside of another view (rails 4)

Hi I want to preface this by saying that I am new to coding. I have an issue that I believe can be solved in two ways A. by rendering a partial B. by updating the controller ( I can totally be wrong but these are what I suspect lol) I have two…
Alicia T. Glenn
  • 107
  • 1
  • 1
  • 6
6
votes
3 answers

asp.net mvc 4 calling method from controller by button

In my Controllers i have class AccountController and within in i have this method [HttpPost] [ValidateAntiForgeryToken] public ActionResult LogOff() { WebSecurity.Logout(); return RedirectToAction("Index", "Home"); } In my Views i have…
mikrimouse
  • 277
  • 1
  • 6
  • 24
6
votes
1 answer

Setting Rails cookie to expire in 1 day

Looking through the docs here http://api.rubyonrails.org/classes/ActionDispatch/Cookies.html, and setting a Rails cookie as follows: cookies[:votes_left] = { :value => 3, :expires => 24.hours.from_now } Inside my browser (Chrome), it's reporting the…
pruett
  • 2,101
  • 3
  • 22
  • 36
6
votes
3 answers

How to (auto) generate a webapi controller for MVC + Entity or generically query all types

Being new to MVC4 + Entity + WebAPI I was frustrated that in order to simply have GET, POST controller handlers and custom mappings to data models. What I guess I'm asking is there a generation tool to, for instance make your controller class from…
FlavorScape
  • 13,301
  • 12
  • 75
  • 117
6
votes
2 answers

Modifying BaseController in rails ActiveAdmin gem

I am using the ActiveAdmin gem in a rails app. If I wanted to add a new before filter that applies to all activeadmin gems, how would I do this? I imagine I could modify the BaseController in ActiveAdmin to achieve this, but what is the proper way…
John
  • 13,125
  • 14
  • 52
  • 73
5
votes
2 answers

Rails - Two controllers or adding actions?

Designing a web app with a admin section and a public facing section. It feels like having a public facing controller just for "index" and "show" is a bit redundant. All the suggestions I've read suggest a namespace for admin, which is fine. I just…
TMB
  • 105
  • 4
1 2
3
60 61