controller

Grails domain obj action argument and association data binding

一笑奈何 提交于 2019-12-23 12:32:33
问题 I know Grails v2.3 introduced some changes to the way data binding works, but I'm struggling to figure out how to get automatic association binding to work when I have an domain obj as the action argument. For instance, with a couple of simple domain objects: class Author { String name List books static hasMany = [books: Book] } class Book { String name static belongsTo = [author: Author] } and controller action: def doSomething(Author a) { // only simple properties appear to be bound at this

Zend framework: “url not found” only with index controller, only if lowercase

不羁岁月 提交于 2019-12-23 12:26:42
问题 This is my problem: I have a working zend application running on aruba/linux. It seems to work well. I have some controllers: index, user, video, ... if i type "http://www.foo.com/public/" i can reach my index controller and index action. if i type "http://www.foo.com/public/user/register" i can reach my user controller and register action. if i type "http://www.foo.com/public/index/index" the server return url not found :( But the most strange thing is that if i type "http://www.foo.com

Reverse order of display of blog entries and comments, Ruby on Rails

久未见 提交于 2019-12-23 10:06:40
问题 I am new to rails so could use some help here. I have followed several tutorials to create a blog with comments and even some of the AJAX bells and whistles and I am stuck on something that I hope is easy. The default display for both blogs and comments is to list the oldest first. How do I reverse that to show the most recent entries and the most recent comments at the top. Don't really know if this is a function of the controller or model. I have done some customization so here is the code

Cakephp cron job to call a controller's action

坚强是说给别人听的谎言 提交于 2019-12-23 09:34:52
问题 I started to use CakePHP (1.2) a few months ago to add small features to the company's application and I'm not too familiar with it. We test locally then on a development server before merging to a production server. I want a controller action to be called every hour with what I assumed to be the best way to do this through my researches, a cron job. Attempt 1 After reading these, http://bakery.cakephp.org/articles/mathew_attlee/2006/12/05/calling-controller-actions-from-cron-and-the-command

Get environment inside controller

ⅰ亾dé卋堺 提交于 2019-12-23 09:33:06
问题 I have a situation in one of my controllers that should only be accessed via AJAX, I have the following code. if (!$request->isXmlHttpRequest()) { $response = new Response(); $response->setContent('AJAX requests only!'); return $response; } When I am testing this gives me an issue because the request hasn't actually been made via AJAX. This then breaks my tests every time. How should I go about working around this? My Ideas: I have tried to set a server header but have had absolutely no

Devise Rspec registration controller test failing on update as if it was trying to confirm email address

不羁的心 提交于 2019-12-23 09:22:23
问题 I have the following route: devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks", :registrations => 'users/registrations', :sessions => "users/sessions" } and the following controller test (registrations_controller_spec.rb): require File.dirname(__FILE__) + '/../spec_helper' describe Users::RegistrationsController do include Devise::TestHelpers fixtures :all render_views before(:each) do @request.env["devise.mapping"] = Devise.mappings[:user] end describe

Missing Scaffolding Options in ASP.NET MVC 3 Add Controller Dialog

我的梦境 提交于 2019-12-23 08:59:23
问题 I have downloaded and installed the release version of ASP.NET MVC 3 (File version: 1.13.113.0), Created a new project of type ASP.NET MVC 3 web application. When I right click on Controllers folder=>Add Controller, The Add Controller dialog doesn't have any scaffolding option. It just contains a textbox for Controller name and a checkbox to add action methods for CRUD scenarios. should I do anything to view the Scaffolding options (Template, Model Class, Data Context Class and View) in Add

Thunderdome MVC- Why one-model-in in MVC?

删除回忆录丶 提交于 2019-12-23 08:53:22
问题 When Jeremy & Chad posted about their FubuMvc project, one of the differentiators they mentioned was their "Thunderdome Principal": The “Thunderdome Principle” – All Controller methods take in one ViewModel object (or zero objects in some cases) and return a single ViewModel object (one object enters, one object leaves). The Controller classes will NEVER be directly exposed to anything related to HttpContext. Nothing makes me cry like seeing people trying to write tests that mock or stub that

Ruby on Rails : get route using controller, action & param

限于喜欢 提交于 2019-12-23 07:30:31
问题 I am quite new to RoR and I am looking for a way of getting a route for a given controller, action & param. Something similar to url_for() but without the domain and protocol. Lets say I have : params = {"controller"=>"controller", "action"=>"edit", "project_id"=>"1"} I need to get : route = "/controller/edit/1" It would be best if I do not have to manually build the route and if I don't need to split the result of url_for(). Does RoR natively support such a feature? It's probably an easy

Can't load URL into iframe with angularJS

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 07:06:17
问题 Using AngularJS, Im trying to load the "myLink" URL address to iframe in another html. data.No is the id that i pull from another place and works fine (get the Id that i need for the url) in the controller - "TransactionsCtrl": $scope.myLink = "http://"the real url"+ data.No +"&file="+ data.No +"&contract_id="+ data.No; console.log($scope.myLink); in the HTML : <div ng-controller= "TransactionsCtrl"> <iframe ng-src="{{myLink}}"></iframe> </div> and all i get is this : Error: [$interpolate