草庐IT

javascript - Laravel 无法正常工作

全部标签

ruby-on-rails - Rails 服务器不工作?

我正在关注firstRubyonRails3tutorial来自PeepCode在大约27-29分钟后,他们让我们启动Rails服务器。据我所知,我已成功安装Rails(和Ruby)。当我运行命令railsserver(根据视频的说明从Windows7命令提示符),我收到消息:=>BootingWEBrick=>Rails3.1.3applicationstartingindevelopmentonhttp://0.0.0.0:3000=>Callwith-dtodetach=>Ctrl-Ctoshutdownserver[2011-12-0218:37:57]INFOWEBrick1

ruby-on-rails - 无法写入未知属性 `scrapbook_entry_id'

正在尝试将数据添加到scrapbook_entries的连接表中,其中has_one:scrapbook和has_one:recipe。:recipe和:scrapbook已经存在。我正在尝试添加它们以将它们与scrapbook_entries表链接起来。form_for添加到scrapbook_entries表:scrapbook_entries_path(params[:id]))do|f|%>@recipe.id%>剪贴簿_条目_Controller:defcreate@recipe=Recipe.find(params[:scrapbook_entry][:recipe_id]

ruby - 无法使用 Vagrant 转发端口访问主机上的 Sinatra 应用程序

在使用rubyapp.rb和foremanstart启动我的Sinatra应用程序后,我无法使用localhost和主机上的相应端口访问我的应用程序。我还能够从客户机的shell中curl到应用程序,而在主机上curl请求失败。据我所知,guest计算机上不应该安装防火墙,因为我使用的是VagrantUbuntu镜像。我的Vagrantfile如下:Vagrant.configure('2')do|config|config.vm.box='precise32'config.vm.box_url='http://files.vagrantup.com/precise32.box'con

ruby - 配置 RSpec 以将 Capybara.javascript_driver 用于所有请求规范

是否可以全局配置RSpec以对所有请求规范使用Capybara的(默认或自定义)JavaScript驱动程序?我们有时会忘记手动将js:true添加到每个请求规范中,这有点烦人。 最佳答案 在spec_helper.rb中,设置以下内容:config.before(:each)doifexample.metadata[:type]==:requestCapybara.current_driver=:selenium#orequivalentjavascriptdriveryouareusingelseCapybara.use_def

arrays - Ruby:删除数组的第一个和最后一个元素 - 为什么解决方案以一种方式而不是另一种方式工作

我想知道为什么第二个解决方案有效,而第一个具有链式方法的解决方案却无效。这个链式方法不起作用:nopers=[5,6,7,8,9]classArraydefine_method(:trimy)doself.shift().pop()endend当我测试nopers.trimy()时,它给出了未定义的错误消息。"method'pop'for1:Fixnum,in'blockin'"并且只执行.pop()方法,删除5。但是,这个版本有效:yuppers=[1,2,3,4,5,6]classArraydefine_method(:trim)doself.shift()self.pop()en

ruby-on-rails - database.yml &references 不工作

我们刚刚将虚拟机升级到我认为相同的ruby​​配置(通过RVM...Ruby1.9.2、Rails3.0.7、DataMapper1.1.0)。最大的区别是我们从MySQL5.0升级到5.1。出于某种原因,在我们的旧VM上运行的完全相同的代码/database.yml现在在我们的新VM尝试连接到数据库时失败了。问题是这个YAML:mysql_defaults:&mysql_defaultsadapter:mysqlencoding:UTF-8username:userpassword:passhost:localhostdevelopment:正在扩展到:"mysql_defaults

ruby - 无法通过 rvm 安装 compass

在Ubuntu11.10中,我是一个快乐且无忧的compass用户。我升级到12.04并遇到了这个问题:Compass(ruby)encodingerror我以某种方式设法解决了通过rvm在我的一台计算机上安装ruby​​的问题,但现在我在另一台计算机上遇到了不同的错误(具有相同的初始问题)。我安装了ruby​​和compass并默认使用全局gemset:gemlist***LOCALGEMS***bundler(1.1.3)chunky_png(1.2.5)compass(0.12.1)fssm(0.2.9)rake(0.9.2.2)rubygems-bundler(1.0.0)rv

ruby - Rails——before_save 不工作?

我正在学习MichaelHartl的RoR教程,它涵盖了密码加密的基础知识。这是当前的用户模型:classUsertrue,:length=>{:maximum=>50}validates:email,:presence=>true,:format=>{:with=>email_regex},:uniqueness=>{:case_sensitive=>false}validates:password,:presence=>true,:length=>{:maximum=>20,:minimum=>6},:confirmation=>truebefore_save:encrypt_pa

ruby - 无法更改 RVM 默认值

我在更改默认ruby​​时遇到问题。运行OSXLion。macbook:~work$rvmlistrvmrubies=*ruby-1.9.2-p290[x86_64]ruby-1.9.2-p318[x86_64]如您所见,1.9.2-p290是默认值。macbook:~work$rvmuse--defaultruby-1.9.2-p318Using/usr/local/rvm/gems/ruby-1.9.2-p318macbook:~work$rvmlistrvmrubies*ruby-1.9.2-p290[x86_64]=>ruby-1.9.2-p318[x86_64]运行rvmus

ruby-on-rails - RMagick gem 无法在 Debian Stable 上安装

编辑:[已修复]问题是我已经安装了它,但不知道,并尝试从源代码安装。这创建了两个版本,gem不知道使用哪个。我通过转到下载的源并运行来修复它sudomakeuninstall然后我再次运行geminstallrmagick并且成功了![原始问题]我正在尝试像thisrailscast中那样安装rmagickgem.这是我放入gemfile的片段:gem'rmagick'gem'carrierwave'当我运行bundleinstall时,我得到以下输出:Installingrmagick(2.13.1)withnativeextensionsGem::Installer::Extens