controller

Could not find devise mapping for path “/sessions/user” devise log in error

我的未来我决定 提交于 2019-12-04 01:11:54
Very frustrating for the last few days. I have a rails app with Devise installed where I generated a new User model and I generated Devise views as well. This happens when I try to sign in as an existing user right when I click "Log in" after filling out the email and password fields: AbstractController::ActionNotFound - Could not find devise mapping for path "/sessions/user". This may happen for two reasons: 1) You forgot to wrap your route inside the scope block. For example: devise_scope :user do get "/some/route" => "some_devise_controller" end 2) You are testing a Devise controller

Subcontroller not being injected into main controller

自古美人都是妖i 提交于 2019-12-04 01:06:37
问题 I have a BorderPane (associated with a MainController), the FXML for the BorderPane uses <fx:include> to include a Label (with a controller StatusBarController) into the bottom region of the BorderPane. Unfortunately the the StatusBarController is not injected into the MainController class instance and I can't understand why. main.fxml: BorderPane with the included statusbar <fx:root type="javafx.scene.layout.BorderPane" fx:id="borderPane" xmlns:fx="http://javafx.com/fxml" fx:controller="com

rails - DRY respond_to with repeated actions

落爺英雄遲暮 提交于 2019-12-04 00:15:00
问题 In one of my rails controller, I must respond to several types of formats, so I use the typical respond_to chain: respond_to do |format| format.html { ... } format.mobile { ... } format.jpg { ... } format.xml { ... } format.js { ... } end Usually that the { ... } part is repeated on several formats. What is the best way to stay DRY on this case? On an scenario in which html , mobile and xml have a "repeated" action, I'd like to do something like this: respond_to do |format| format[:html,

How to check security acess (@Secured or @PreAuthorize) before validation (@Valid) in my Controller?

[亡魂溺海] 提交于 2019-12-03 23:51:24
问题 here is my Controller code : @PreAuthorize("hasRole('CREATE_USER')") @RequestMapping(method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public UserReturnRO createUser(@Valid @RequestBody UserRO userRO) throws BadParameterException{ return userService.createUser(userRO); } My need is when a client without the appropriate role tries to create a user, the controller responds "Not authorized" even if the data sent

Access controller in another controller class

丶灬走出姿态 提交于 2019-12-03 20:25:38
问题 I have root layout containing 2 layouts: - OptionsPane - DrawArea What i am trying is to access DrawAreaController in OptionsPaneController to call its draw method. Below is initialize method from OptionsPaneController: @Override public void initialize(URL url, ResourceBundle rb) { newDragonButton.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { if(newDragonButton.getText().equals("Nowy")){ //do something } else{

How can I create a Spring controller without the use of the annotations?

元气小坏坏 提交于 2019-12-03 20:17:53
I am studying for the Spring Core certification and I have some doubts related this question: What is the @Controller annotation used for? How can you create a controller without an annotation? So I know that the @Controller annotation indicates that a particular class serves the role of a controller. The @Controller annotation acts as a stereotype for the annotated class, indicating its role. The dispatcher scans such annotated classes for mapped methods and detects @RequestMapping annotations. So a controller class is something like this: @Controller public class AccountController {

MVC, not “supposed” to use HttpContext.Current anymore?

ε祈祈猫儿з 提交于 2019-12-03 19:30:42
问题 Someone in a post here, commented that you should not use HttpContext.Current when using MVC, rather, you should be using ControllerBase.ControllerContext. In some respects, this makes sense, but in other respects it doesn't. For example, ControllerContext is an instance variable, so everywhere I want to reference, say, my Session variables, I need to have a reference to the Controller? Why are we "not supposed" to be using HttpContext.Current in MVC, when you still can? Is there an

StructureMap controller factory and null controller instance in MVC

大城市里の小女人 提交于 2019-12-03 17:26:31
问题 I'm still trying to figure things out with StructureMap and one of the issues i'm running into is my Controller Factory class blowing up when a null controller type is passed to it. This only happens when the application builds for the first time, after which every subsequent build works fine. Even when i shutdown Visual Studio and reopen the project (I'm not running this in IIS). It's almost like there is some sort of caching going on. This is what the controller class looks like: public

AngularJS - controller doesn't get data from service when using $http

﹥>﹥吖頭↗ 提交于 2019-12-03 17:16:51
I have simple web app where I like to load some data from json. At the moment the data is hardcoded within my service and everything is working. When I change my service to load the same data from an external json file the controller renders the view before it gets some data. That's what it looks like now: function() { var tripsService = function() { var trips = [{ .... SOME DATA }]; this.getTrips = function() { return trips; }; }; angular.module('customersApp').service('tripsService', tripsService); }()); Using $http.get : function() { var tripsService = function() { var trips = []; this

How to pass data from jQuery to controller?

孤街醉人 提交于 2019-12-03 17:16:28
I have two fields - end and start date(daterange) and I should pass them into controller and reload this page. Here is my code from view: <%= form_tag(:controller => "financial_reports", :action => 'index', :method => 'post') do%>//maybe this line should be edited <%= datepicker_input "report","start_date", :dateFormat => "dd/mm/yy" %> <%= datepicker_input "report", "end_date", :dateFormat => "dd/mm/yy"%> <%end%> and generated HTML() : <form accept-charset="UTF-8" action="/financial_reports?method=post" method="post"...> <input id="report_start_date" name="report[start_date]" size="30" type=