我从捆绑器中收到了一个我从未见过的奇怪错误。在bundle install我得到:
Please CGI escape your usernames and passwords before setting them for authentication
这仅在一个回购中发生,我怀疑它与来自github的gem来源有关该gemfile中的几个gem有关。值得注意的是,这些获取是从而git://github.com/不是SSH获取的。不知道这是否是导致问题的原因。
在Bundlers文档中找不到与此相关的任何信息,因此非常感谢您提供任何见解或指导。
编辑(添加Gemfile):
ruby '2.2.2'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '>= 5.0.0.rc1', '< 5.1'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.18'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
gem 'bootstrap', '~> 4.0.0.alpha3'
gem 'font-awesome-rails'
# Use Uglifier …Run Code Online (Sandbox Code Playgroud) 这是一个关于反应而不是特定问题的架构问题,但是什么被认为是使用布局组件管理状态/道具的最佳实践,以及基于URL呈现的多个子组件?
注意:我知道已经提出了类似的问题,但这有点不同.[ 如何使用React-Router更新基于URL /路径的ReactJS组件
假设我有类似下面的代码:一个配置文件页面(主布局视图),其中包含配置文件子部分的导航链接(设置,首选项,帐户详细信息等),以及一个主面板,其中每个子部分都被渲染.
所以目前我会有这样的东西:我的路由器 routes.js
<Router history={browserHistory}>
<Route path='/profile' component={Profile} >
<IndexRoute component={Summary} />
<Route path='/profile/settings' component={Settings} />
<Route path='/profile/account' component={Account} />
<Route path='/profile/preferences' component={Preferences} />
</Route>
</Router>
Run Code Online (Sandbox Code Playgroud)
以及我的配置文件布局组件profile.js的精简版本
class Profile extends React.Component {
constructor(props) {
super(props)
}
render(){
let pathName = this.props.location.pathname;
return(
<div className='container profile-page'>
<div className='side-nav'>
<ul>
<li><Link to='/profile'>Summary</Link></li>
<li><Link to='/profile/settings'>Settings</Link></li>
<li><Link to='/profile/account'>My Account</Link></li>
<li><Link to='/profile/preferences'>Preferences</Link></li>
</ul>
</div>
<div className='main-content'>
{this.props.children}
</div>
</div>
)
}
}
export default Profile;
Run Code Online (Sandbox Code Playgroud)
所以这种作品.子组件将基于URL呈现.但那我该如何管理州和道具呢?我理解React和Flux的方式,我希望Profile组件管理状态并监听我的商店中的更改,并将这些更改传播给它的子项.它是否正确?
我的问题是似乎没有一种直观的方式将道具传递给this.props.children呈现的组件,这让我觉得我当前的架构和/或对通量的理解是不正确的.
非常感谢一点指导.
感谢您的耐心等待.对Rails来说还是个新手.
使用Rails 3.2
为简单的应用程序制作注册页面.我的问题是我的表单上的提交按钮不会产生任何影响,无论表单中的信息是否有效.
用户模型和数据库似乎都工作正常.如果我从rails控制台手动添加用户,它会将其添加到数据库中.据我所知,问题似乎是由form_for生成的形式.
这是有问题的页面:
<% provide(:title, 'Sign up') %>
<h1>Sign up</h1>
<div class="row">
<div class="span6 offset3>
<%= form_for(@user) do |f| %>
<%= render 'shared/error_messages' %>
<%= f.label :name %>
<%= f.text_field :name %>
<%= f.label :email %>
<%= f.text_field :email %>
<%= f.label :password %>
<%= f.password_field :password %>
<%= f.label :password_confirmation, "Confirmation" %>
<%= f.password_field :password_confirmation %>
<%= f.submit "Create my account", class: "btn btn-large btn-primary" %>
<% end %>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
这是我的用户控制器:
def show
@user = …Run Code Online (Sandbox Code Playgroud) 谢谢阅读.一般来说,Javascript和编程都是新手.
我正在寻找一种方法来返回给定数字的最大素数因子.我的第一直觉是使用while循环来计算并查找数字的素数因子,将因子存储在数组中并在每次找到时重置.这样,数组中的最后一项应该是最大的素数因子.
var primerizer = function(input){
var factors = [];
var numStorage = input
for (x=2; numStorage != 1; x++){ // counter stops when the divisor is equal to the last number in the
// array, meaning the input has been fully factorized
if (result === 0) { // check if the number is prime; if it is not prime
factors.push(x); // add the divisor to the array of prime numbers
numStorage = numStorage/x // divide the number being calculated …Run Code Online (Sandbox Code Playgroud)