controller

Rails -- Would like to create a controller with a dash or underscore in name

Hello, I wanted to create some basic html pages to add to my rails app. I figured the restful way to do it would be to create a controller. The problem is I'd like the pages to be a two word title. => ex. www.mydomain.com/foo-bar/ For SEO reasons it really must be two words, and I need the separation...using www.mydomain.com/foobar...

In rails controllers, how to prevent double submit (when user double-clic submit button or hit enter twice) ?

Well, everything's in the title but I'll explain a little more :-) My rails app contain many forms (Ajaxified or not). To prevent users to submit twice or more some forms, I use Javascript. There's my scenario for a Ajaxified form : the user submit the form (clic or enter) the javascript disable the submit button the rails controlle...

Best ASP.NET MVC practice to distinguish GET/POST action methods with same signature?

When implementing Edit action, I add two methods for Get and Post: Edit(string id) Ideally, they need have same signature. But of course this is not compilable. So I add a dummy parameter to HttpPost method (form in my case): [HttpGet] public ActionResult Edit(string id) { var user = Entities.Users.SingleOrDefault(s => s.UserID == ...

Getting an ActionController::InvalidAuthenticityToken for my XML

I am working with a third-party API. That server is supposed to POST back to my URL. My URL is: http://www.mydomain.com/teleku/playvoice.xml The controller has some logic, but basically contains a respond_to do block and the corresponding view is a very basic xml builder. However, I get the following error in the logs: ActionCo...

Authlogic and RSpec, errors only running all examples

I have a Profiles Controller that acts_as_authentic with AuthLogic and I am trying to test this action: class ProfilesController < ApplicationController before_filter :require_user, :except => ['new', 'create'] def index redirect_to(current_user) end end The following example is in a spec file with 18 other pending examples...

iPhone Navigation Stack Pushing and a Popping

I have an Application. I wish to push View controllers A, B, C, D and E in various arbitrary orders. A is the Home page, so you could say it is the root, Super VC. But any scenario could occur: A->B->C->B->C->D->A->B->C ... etc. Is the UINavigationController the existing answer to my problems? Keep in mind, my View controllers are c...

Preventing users from making themselves admins

In my app, I have a "User" model, which includes a number of attributes including "has_admin_rights". If true, the user is an admin, if false, they aren't. Each user has a profile, with their login name, email address, profile pic, etc. If I'm logged in as a regular user, I can click on a page called "profile", and I can edit my own ac...

Rails-way of structuring admin/user/public controllers

Hi there, A fictitious Rails app has the following resources: Photographers Images Comments A Photographer has many Images, that have many Comments Each photographer has a login and is able to view, upload, edit and delete their images, comments as well as their own profile. An administration interface is available and can edit bot...

How can I prevent duplicate content when re-routing pages in CodeIgniter?

Say I have a controller, "Articles" but I want it to appear as a sub-folder (e.g. "blog/articles"), I can add a route like this: $route['blog/articles'] = 'articles'; $route['blog/articles/(:any)'] = 'articles/$1'; This works fine, the only problem now is that example.com/articles and example.com/blog/articles both use the Blog contro...

Magento: How to determine if customer aborted checkout process

I'm working on a custom module that needs to know if/when a user has aborted the checkout process. "Aborting" simply means they landed on the checkout's indexAction but didn't complete the process. It's absolutely essential that I know if/when this happens. I was thinking maybe set a session variable that they've entered checkout. On ...

How do I pass a list of integers to an MVC action?

I have an action that depends on a list of integers. My first instinct was to simply declare the action with a List. I tried declaring the action in the controller as: public ActionResult EditMultiple(List<int> ids) and in my View call like so: <%= Html.ActionLink("EditMultiple", "EditMultiple", new { ids = new List<int> {2, 2, 2} ...

Controller (Spring Managed Bean) Scope Question: Singleton, Request or Session?

The question is a bit long since it's conceptual. I hope it's not a bad read :) I'm working in a performance critical Spring MVC/Tiles web-app (10,000 users typical load). We load an update employee screen, where we load an employee details screen (bound to an employee business object) for updates via a MultiActionController. There are ...

Why is BaseController's overloaded constructor not being executed?

I have a base controller which is defined as follows, but the constructor that takes the ISiteService never gets executed: public class BaseController : Controller { private ISiteService _siteService; public BaseController() {} public BaseController(ISiteService siteService) { _siteService = siteService; // thi...

HttpApplicationState not available in an MVC controller

Hi, I'm using MVC2 and VS2010 developing a website and need to use Application State global values. I can set a value like 'Application["hits"]=0;' in Global.asax but when trying to use the same in an MVC controller always get the following error: The name 'Application' does not exist in the current context I have also tried using in...

How do I filter or find a Model based on a method in that Model?

Hi, I have a controller which is looking for a set of Contacts from the Contacts table. Currently it looks like this: @contacts = @campaign.contacts.find(:all, :order => "date_entered ASC") The method in the contact.rb (Model) is this: def status return if statuses.empty? a= statuses.find(:last).status << ' (' << statuses.fin...

Problem passing variable from javascript to controller Codeigniter

I'm struggling with this and just can't seem to make it work. Need to pass the current users date (cdate) variable to my controller and in spite my alert windows shows the correct value, that value never reaches the controller. Here's the javascript code: $(document).ready(function() { $('#submit').click(function() { v...

Rails controller/routing question

I am new to RoR and I cant get one of my rotes to work, not sure whats going on? I have defined a route in my routes.rb file, somthing like this... map.connect 'myurl/:someid/:start/:limit', :conditions => { :method => :get }, :controller => 'mycontroller', :action => 'get_data_list' # method defintion in mycontroller def get_data_lis...

Why am I getting an undefined property error when my relationships seem correct?

I'm having a slight problem that I can't figure out, but should be really simple. I have the following model structure in my cakePHP (1.3) app: ProspectiveQuote [hasMany] QuoteUnit [belongsTo] Unit but in my ProspectiveQuotesController the line: $this->ProspectiveQuote->QuoteUnit->Unit->find('list'); gives me the following error:...

ASP.NET MVC - Routing still confusing for me.

Hi everyone. I'm having difficulty with the concept of Routing within the ASP.NET MVC Framework. For example, I have a controller method: public class UploadController : Controller { public ActionResult Index() { return View(); } [AcceptVerbs(HttpVerbs.Get)] public ActionResult GetChildFolders(string id) {...

How can I remove callbacks inserted by vendor code?

A gem I am using inserts an after_save callback that I would like to remove. It seems to me it would be cleaner to delete a symbol from an array than to fix the problem with a monkeypatch. How can I access the array of callbacks? ...