这是什么意思。 =>在铁轨 [英] What does it mean. => in rails

查看:120
本文介绍了这是什么意思。 =>在铁轨的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道轨道中以下符号的含义吗?



=>



Can anyone know the meaning for the following symbol in rails?

=>

def update
  account = Account.find params[:id]
  permitted = params.require(:account).permit(:name, :otherparam)
  account.update_attributes permitted
  render :json => account
end





出于什么目的我们需要使用上面的表达式?



我在谷歌搜索过它。但没有运气。





提前致谢



for what purpose we need to use the above expression?

I have searched it in google. but no luck.


Thanks in advance

推荐答案

这是称为哈希火箭。用于创建像这样的哈希 {key1 => value1,key2 => value2}

顺便说一句,新样式语法(Ruby 1.9)是: {key1:value1,key2:value2}



祝你好运!
It is called a Hash Rocket. Used for creating hashes like this {key1 => value1, key2 => value2}
By the way, new style syntax (Ruby 1.9) is: {key1: value1, key2: value2}

Good luck!


这叫做箭头功能。



与函数表达式相比,箭头函数表达式(也称为胖箭头函数)具有更短的语法,并且词汇绑定此值。箭头功能始终是匿名的。



https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions [ ^ ]



这个是一项新技术,是ECMAScript 2015(ES6)标准的一部分。

该技术的规范已经完成,但请查看兼容性表,了解各种浏览器的使用情况和实施状态。
This is called Arrow functions.

An arrow function expression (also known as fat arrow function) has a shorter syntax compared to function expressions and lexically binds the this value. Arrow functions are always anonymous.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions[^]

This is a new technology, part of the ECMAScript 2015 (ES6) standard.
This technology's specification has been finalized, but check the compatibility table for usage and implementation status in various browsers.


这篇关于这是什么意思。 =>在铁轨的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆