params

Rendering rails partial with dynamic variables

夙愿已清 提交于 2019-12-13 07:19:06
问题 I'm trying to render a partial based on the taxon the user is inside. In my application.html.erb layout I have the following line of code: <%= render 'spree/shared/women_subnav' if @enable_women %> In the taxons controller, inside the show method, I have: @taxon_id = params[:id].split('/').first And in taxons#show I have: <% if @taxon_id == params[:id].split('/').first %> <%= "@enable_#{@taxon_id}" = true %> <% end %> When I run this I get a SyntaxError. But in taxons#show If I just enter: <%

Render a rails partial based on the id of an action

a 夏天 提交于 2019-12-13 06:16:41
问题 I'm building a small ecommerce site that sells a variety of mens and womens clothing. i would like to render a partial based on which taxonomy the user is in. For example, if the user is at mysite.com/t/women/pants I would like to render _women.html.erb, or, if the user is at mysite.com/t/men/shirts I would like to render _men.html.erb. I have a Taxonomy model that has_many taxons, and the Taxon model has_many products. In taxons_controller.rb I have: def show @taxon = Taxon.find_by_permalink

Parsing Grails params with a “variable” index

南笙酒味 提交于 2019-12-13 05:19:32
问题 I am fairly new to Grails, and I would like to understand how to parse some form "params" with a controller, using a counter variable as an index? I have a form: <g:form controller="config" action="parseReports"> <div> <g:each in="${allReports.toList()}" var="each" > <g:hiddenField name="reportName${allReports.indexOf(each)}" value="${each}" /> </g:each> <g:hiddenField name="reportCountSize" value="${allReports.size()}" /> ... With some hidden variables. In the controller, I have: def

how to pass params using a route in Zend Framework 2?

谁说胖子不能爱 提交于 2019-12-13 02:13:25
问题 i have a router test/view and i would like to pass some params like test/view/id/123 . Im not sure how to add those params in the zf2 router. 'router' => array( 'routes' => array( 'test' => array( 'type' => 'Literal', 'options' => array( 'route' => '/test', 'defaults' => array( '__NAMESPACE__' => 'test\Controller', 'controller' => 'Index', 'action' => 'index', ), ), 'may_terminate' => true, 'child_routes' => array( 'view' => array( 'type' => 'Literal', 'options' => array( 'route' => '/view',

How to call a method with the C# collection initializer?

旧巷老猫 提交于 2019-12-13 02:10:45
问题 Case This morning I refactored some Logging method and needed to change a method's 'params' parameter in a normal array. Consequently, the call to the method had to change with an array parameter. I'd like the method call to change as less as possible, since it's a heavily used utility method. I assumed I should be able to use the collection initializer to call the method, but it gave me a compile-error. See the second call in the example below. The third call would be fine too, but also

request variables in grails

我怕爱的太早我们不能终老 提交于 2019-12-13 01:54:02
问题 EDIT : based on feedback, erased original Q. completely and reposting in better language I wish to access a request or params variable and pass it between the controller and the gsp. i understand that the params object contains everything that a querystring has. All the examples I see are all Model driven. I have looked up docs online and I have two books - beginning-grails and definitive guide to grails, both have database driven examples on params. I want to understand how params can be set

Powershell script with params *and* functions

a 夏天 提交于 2019-12-12 11:05:51
问题 I want to write a powershell script that takes in params and uses functions. I tried this: param ( $arg ) Func $arg; function Func($arg) { Write-Output $arg; } but I got this: The term 'Func' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At func.ps1:6 char:5 + Func <<<< $arg; + CategoryInfo : ObjectNotFound: (Func:String) [],

How do I pass a XSLT parameter to a XmlDataSource correctly?

☆樱花仙子☆ 提交于 2019-12-12 05:55:45
问题 I believe I have all the code correct but I can't get it to work. The GridView has allowSorting = true. So in theory, when I click on the column header the xml in the gridview should sort by that column. The XML shows in the GridView, but doesn't sort at all. I'm stumped. DST_Test.Xml <?xml version="1.0" encoding="utf-8" ?> <root> <data name="Test1.Text" xml:space="preserve"> <value>Please Pick Bare Pump</value> <comment>Tab - Pump Configuration</comment> </data> <data name="Test2.Text" xml

Angular ui-router : Passing params between states [duplicate]

回眸只為那壹抹淺笑 提交于 2019-12-12 03:25:13
问题 This question already has answers here : AngularJS ui router passing data between states without URL (2 answers) Closed 3 years ago . I'm trying to pass a message from state1 to state2 in ui-router. looked up most of the question on here about this topic but unfortunately can't make sense of it. This is my main code and $stateProvider : myApp.config(function($stateProvider, $urlRouterProvider) { // // For any unmatched url, redirect to /state1 $urlRouterProvider.otherwise("/state1"); // //

Execute external program with specific parameters from windows c/c++ code

Deadly 提交于 2019-12-12 02:48:31
问题 I want to call Program1 from Program2 with exact same parameters which I called Program2 with. In Linux, I can do it like this: int main(char argc, char* argv[]){ execv("./Program1", argv); } In windows, I tried CreateProcess but as the first post says there is potential issue: "argv[0] Doesn't Contain the Module Name as Expected". I do want to send proper argv[0] to Program1. What should I do? 回答1: argv[0] is the name of the program itself. You should do : int main(char argc, char **argv) {