params

$state, $stateParams, getting undefined object

早过忘川 提交于 2019-12-10 14:23:05
问题 I am getting unexpected results from both methods. I have my $state configed $stateProvider .state('status', { url: "/status/:payment", controller: 'QuestCtrl', templateUrl: "index.html" }); And on the Controller I have: angular.module('quest').controller('QuestCtrl',function($scope,$stateParams,$state){ console.log($stateParams.payment); // undefined console.log($state); // Object {params: Object, current: Object, $current: extend, transition: null} } I already used $stateParams in other

Passing Parameters of AJAX POST to Grails Controller

岁酱吖の 提交于 2019-12-10 14:17:48
问题 I´m building a social network with Grails and got stucked on giving users inner their editprofile page the chance to paste an youtube-Url into a textfield and by clicking a button a JS regexxes the id out of the URL pasted, an ajax post is fired updating a div with a preview image of the youtube video the html looks like : <g:textField name="videoinput" class="videoinput reLef" value="" /> <span class="daten_videouploadbtn reLef" ></span> <g:render template="/forms/storedVideos" /> the JS

How to configure global uploadPath and uploadUrl in Yii2?

倾然丶 夕夏残阳落幕 提交于 2019-12-10 13:23:35
问题 I want to configure Global Params in Yii2. For example this: This will store the server path for all your file uploads. Yii::$app->params['uploadPath'] = Yii::$app->basePath . '/uploads/'; This will store the Url pointing to server location for your file uploads. Yii::$app->params['uploadUrl'] = Yii::$app->urlManager->baseUrl . '/uploads/'; When I set params like this: 'uploadPath' => Yii::$app->basePath . '/uploads/', 'uploadUrl' => Yii::$app->urlManager->baseUrl . '/uploads/', I am getting

is there a rails method to loop through each line of uploaded file? “each_line” is an IO method but it's not working

杀马特。学长 韩版系。学妹 提交于 2019-12-10 11:29:03
问题 I'm attempting to upload a csv file, parse it, and spit out a file for S3 or just pass to view. I use a file_field_tag to upload the csv. I thought file_field_tag passes an object that is a subclass of IO and would have all ruby IO methods such as "each_line". I can call "read" on the object (method of IO class) but not "each_line"... so how can I iterate over each line of a file_field_tag upload? create method of my controller as: @csv_file = params[:csv_file] My show view which throws a no

How to parse a Mash from LinkedIn to create a Ruby object

不想你离开。 提交于 2019-12-10 08:23:17
问题 I used LinkedIn gem by pengwynn to get authentication from LinkedIn. Everything works fine, and I get a Mash in a callback that looks like this: #<LinkedIn::Mash all=[#<LinkedIn::Mash company=#<LinkedIn::Mash id=1422 industry="Banking" name="Company" size="10,001+ employees" ticker="ABC" type="Public Company"> id=2851554 is_current=true start_date=#<LinkedIn::Mash month=12 year=2008> summary="" title="Boss">] total=1> How can I parse it to something similar to Rails params in order to create

how to pass params using action button in grails

喜你入骨 提交于 2019-12-09 17:54:15
问题 been having toruble with the button that has action. I have several btns which I want to know its paramaeter. In grails tutorial it says it should be like this: <g:actionSubmit action="action" value="${message(code: 'default.button.edit.label', default: 'Edit')}" params="['actionTaken':editPhone]"/> I tried using remotelink, submitButton, submitToRemote tags but none works. I always get null when I try parsing it in my controller: def action= { def actionTaken = params.actionTaken def

Named arguments call in C# with variable parameter number

北城以北 提交于 2019-12-08 18:04:56
问题 Suppose I have the following C# function: void Foo(int bar, params string[] parpar) { } I want to call this function using named arguments: Foo(bar: 5, parpar: "a", "b", "c"); The compiler gives error message: “Named arguments cannot precede positional” since I have no name before “b” and “c”. Is there any way to use named arguments without manually representing params as an array? 回答1: No, there is no syntactic sugar to make variable arguments named except explicitly specifying array. Note

Expecting params hash but getting a string (Rails)

流过昼夜 提交于 2019-12-08 13:44:27
I have a typical signup form which has, for example, three fields: login, password, and email. We're using rails' form helpers, so we are expecting these to come to us in a hash named user. Something close to what we'd expect: Parameters: {"action"=>"new", "controller"=>"users", "user"=>{"password"=>"[FILTERED]", "login"=>"new_user_login", "email"=>"new_user_email"}} We then do stuff like: params[:user].merge(SOME_HASH) # some other stuff we want to save into the user object A few times a day we're getting "undefined method `merge' for String", and looking at those requests, the params are

Rails serialized integer attribute in params, but not saving into model instance

偶尔善良 提交于 2019-12-08 08:29:47
问题 So I have the following model which contains a serialized integer attribute Rake file: class CreateCompanyAssetStats < ActiveRecord::Migration def change create_table :company_asset_stats do |t| t.integer :companyID t.string :geo t.integer :assetType t.date :startTime t.date :endTime t.timestamps end end end Model: serialize :companyID, Array serialize :assetType, Array serialize :geo, Array In my view I have a form where I have a multiselect dropdown that stores the value(s) into params:

Expecting params hash but getting a string (Rails)

ぃ、小莉子 提交于 2019-12-08 07:06:59
问题 I have a typical signup form which has, for example, three fields: login, password, and email. We're using rails' form helpers, so we are expecting these to come to us in a hash named user. Something close to what we'd expect: Parameters: {"action"=>"new", "controller"=>"users", "user"=>{"password"=>"[FILTERED]", "login"=>"new_user_login", "email"=>"new_user_email"}} We then do stuff like: params[:user].merge(SOME_HASH) # some other stuff we want to save into the user object A few times a day