controller

How can I resolve this? The unit type exists in two dll files

早过忘川 提交于 2019-12-10 12:59:46
问题 I am currently going through a tutorial using Visual Studio 11 beta. When trying to set the max length of a field value in one of my classes: [MaxLength(50)] public string LastName { get; set; } It errors out and wont let me compile because the MaxLength() function exists in two places: Error 4 The type ' System.ComponentModel.DataAnnotations .MaxLengthAttribute' exists in both 'c:\Users\me\Documents\Visual Studio 11\ContosoUniversity\packages\EntityFramework.4.1.10331.0\lib\net40

How does rails determine incoming request format?

杀马特。学长 韩版系。学妹 提交于 2019-12-10 12:36:00
问题 I'm just wondering how rails knows the format of the request as to correctly enter in the famous: respond_to do |format| format.html format.xml format.json end As an example consider this situation I have faced up. Suppose that via javascript (using jQuery) I make a POST request expliciting dataType: json $.ajax({ type: 'POST', url: 'example.com', data: data, dataType: 'json' }); When this request reach controller action, standing inside it with ruby debugger, I inspect @request.format and I

Laravel 4 How to delete a resource with its files and records from the project

ぐ巨炮叔叔 提交于 2019-12-10 12:18:44
问题 I created a controller via the sublime text plugin. Generate resource -> Tweets But later on i wanted to get rid of it and all the files and records it had created on my project so i did the following: deleted: Tweetscontroller.php views/Tweets folder models/Tweets.php create_Tweets_table migration seeds/TweetsTableSeeder.php edited off the records in: route.php databaseseeder.php, run dump-autoload But later when i run "php artisan migrate:refresh" i get the following error on my command

angularjs - passing data between controllers

蹲街弑〆低调 提交于 2019-12-10 12:17:44
问题 I am building an angular app using modals and I'd like to pass some data between my controllers to populate my modal view. My main controller is JobListCtrl and callReportModalData is triggered when I click on the link supposed to call the modal. I use the service reportJobModalData to store the data an pass it between controllers. var myApp = angular.module('myApp', []); myApp.controller('JobListCtrl', ['$scope', '$element', '$http', '$log', 'reportJobModalData', function ($scope, $element,

Name conflict between controller name and presenter namespace

坚强是说给别人听的谎言 提交于 2019-12-10 11:41:44
问题 I am using the presenter pattern and am seemingly running into inconsistent class naming conflicts. I have a pages controller with a homepage method and I'd like to have that method use the Pages::HomepagePresenter class, but end up with the error: uninitialized constant ActionController::Caching::Pages::HomepagePresenter # ./app/controllers/pages_controller.rb:3:in `homepage' # ./spec/requests/pages_spec.rb:14:in `block (5 levels) in <top (required)>' Assuming the problem is with the Pages

Devise : Sign in from a controller

放肆的年华 提交于 2019-12-10 11:25:48
问题 I need to sign in fron non-devise controller. I found this link from devise wiki, but I get error : wrong number of arguments (2 for 0) I did exactly like in the link. What went wrong? Thanks My code : sign_in(:site, Site.find(params["si"])) 回答1: sign_in(:user, User.find(params[:id]) If you do a binding.pry after you'll see that current_user is set. For some reason, doing a redirect after this will make current_user nil. That's why I set something in the session like this and then redirect,

MVC 3 with ajax submit complex object to controller

别来无恙 提交于 2019-12-10 11:12:42
问题 I am using just mvc 3 with c# and ajax javascript and I have a view with a strongly typed model bound to it. <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcApplication2.Models.Car>" %> And I am submitting via a ActionLink... <%=Html.ActionLink("Add Car", "AddCar", "Car", new { id = "tester" })%> this all goes through the ajax/javascript call... $('#tester').click(function (e) { e.preventDefault(); $(this).parents('form').first(

Is it possible in playframework to override the default save action in the CRUD controller and redirect to list after

旧时模样 提交于 2019-12-10 10:57:46
问题 I'm using Play framework's great crud module. The thing is I would like to do some special processing and validation before my object gets saved. So I created a save action in my CRUD controller. So far so good. But now after the object is saved I would like to render the list of objects just like the CRUD module was doing before I overrode its save action. How would I go about doing this? Here is my controller: package controllers.admin; import java.util.List; import models.Category; import

DataTable Model Bind in Mvc

妖精的绣舞 提交于 2019-12-10 10:56:11
问题 I'm using asp.net mvc with aspx view engine to read from an excel file, extract contact information from that, display it to the user and when he\she confirms it would save them in database. Now in my page I got my DataTable as Model and with a foreach loop I'm showing that to the user. then I have a submit button that when the user click on it I want my datatable back to the Action in a Controller. but my Datatable is null. How can I have my datatable back to my controller ? aspx first line

Hide Codeigniter controller name from URL with multiple controllers

孤者浪人 提交于 2019-12-10 10:45:33
问题 I'm using the following code in my routes.php to hide the controller name from the URL structure: $route['(:any)'] = "auth/$1"; It works great, but my problem is this: When I want to access another controller, it seems to treat it as a function of the hidden controller. So for example. I have http://mysite.com/controller1/somefunction which turns into: http://mysite.com/somefunction What if I want to access: http://mysite.com/jsonfunction/anotherfunction/ How can I access the other controller