Rails

Rails tutorial: undefined method

匿名 (未验证) 提交于 2019-12-03 02:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm stuck (again!) at Chapter 9 (this time in section 9.2.2) of the Rails tutorial. I am getting bundle exec rspec spec/ ................................FFF........................ Failures: 1) Authentication authorization as wrong user submitting a GET request to the Users#edit action Failure/Error: before {sign_in user, no_capybara: true} NoMethodError: undefined method `new_remember_token' for #<User:0x007f8181815448> # ./spec/support/utilities.rb:13:in `sign_in' # ./spec/requests/authentication_pages_spec.rb:71:in `block (4 levels) in

Rails: upload a file OR store a url

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm developing a form where I want to allow users to either upload a file, or enter a url to an existing file. The idea is to allow users to attach various 'multimedia' files to entries, some of which may be files from their hard drives (think images, word documents, etc) and some may be urls (youtube videos, images on flickr, etc) Any ideas on how I can accomplish this? I'm currently using carrierwave to handle file uploads, and it seems to work well, but I want to store url's as well. 回答1: What I will probably do is to have a drop down in

Rails tutorial: undefined method

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm stuck (again!) at Chapter 9 (this time in section 9.2.2) of the Rails tutorial. I am getting bundle exec rspec spec/ ................................FFF........................ Failures: 1) Authentication authorization as wrong user submitting a GET request to the Users#edit action Failure/Error: before {sign_in user, no_capybara: true} NoMethodError: undefined method `new_remember_token' for #<User:0x007f8181815448> # ./spec/support/utilities.rb:13:in `sign_in' # ./spec/requests/authentication_pages_spec.rb:71:in `block (4 levels) in

rvm + rails install ERROR: While executing gem (NoMethodError)undefined method `ord' for nil:NilClass

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Ububtu 14.04 rvm 1.26.11 ruby 2.1.0p0 rvm list : rvm rubies =* ruby - 2.1 . 0 [ x86_64 ] # => - current # =* - current && default # * - default which ruby : /home/awlad/.rvm/rubies/ruby-2.1.0/bin/ruby which rvm : /home/awlad/.rvm/bin/rvm which bundle : /usr/bin/bundle RubyGems Environment : - RUBYGEMS VERSION : 2.4 . 8 - RUBY VERSION : 2.1 . 0 ( 2013 - 12 - 25 patchlevel 0 ) [ x86_64 - linux ] - INSTALLATION DIRECTORY : /home/ awlad /. rvm / gems / ruby - 2.1 . 0 - RUBY EXECUTABLE : /home/ awlad /. rvm / rubies / ruby - 2.1 . 0 /

docker executable file not found in $PATH

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Trying to run a rails migration on a running docker compose container throws this error: $ docker-compose run webapp rails db:migrate ERROR: Cannot start service webapp: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"exec: \\"rails\\": executable file not found in $PATH\"\n" However, I can access rails from inside the container: $ docker-compose run webapp bash root@3fd3a87275a1:/home/app/webapp# which rails /usr/local/rvm/gems/ruby-2.3.1/bin/rails My container is already running

BCrypt::Errors::InvalidSalt: invalid salt Devise

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm getting this error when i try to create new User, like this >> User.create(:email=>"nandosousafr@gmail.com", :password => "hello") BCrypt::Errors::InvalidSalt: invalid salt from /Library/Ruby/Gems/1.8/gems/bcrypt-ruby-3.0.1/lib/bcrypt.rb:56:in `hash_secret' from /Library/Ruby/Gems/1.8/gems/bcrypt-ruby-3.0.1/lib/bcrypt.rb:161:in `create' from /Library/Ruby/Gems/1.8/gems/devise-2.1.2/lib/devise/models/database_authenticatable.rb:110:in `password_digest' from /Library/Ruby/Gems/1.8/gems/devise-2.1.2/lib/devise/models/database

Rails App Not Serving Assets in Production Environment

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: My app works fine when run in development environment. In production ( rails server -e production ), the browser can't access the css and js files and on the console there are messages like: I, [2013-07-27T21:00:59.105459 #11449] INFO -- : Started GET "/javascripts/application.js" for 99.102.22.124 at 2013-07-27 21:00:59 +0000 F, [2013-07-27T21:00:59.108302 #11449] FATAL -- : ActionController::RoutingError (No route matches [GET] "/javascripts/application.js"): The head section from html source when in production environment: a Social Server

rails asset pipeline: Invalid CSS

匿名 (未验证) 提交于 2019-12-03 02:34:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to use http://designshack.net/articles/css/build-an-animated-photo-wall-with-css/ to implement a photo wall in my rails app. I plugged the CSS for list, paragraph and image, with the only changes in image height and width into my custom.css.scss like so: The asset pipeline throws the following error in that file: Invalid CSS after " position:": expected pseudoclass or pseudoelement, was " absolute;" Commenting out the position line brings up the next line in the file: Invalid CSS after " top:": expected pseudoclass or

Rails render route path

匿名 (未验证) 提交于 2019-12-03 02:33:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Im still new to Rails and have a hard time understanding how the path system works in Rails. In my routes.rb i create an alias for signup: match 'signup' => 'user#new' resource :user, :controller => 'user' The action is there and going to /signup shows the correct action. So far so good. Now, when i submit my signup form it runs the create action with POST as usual. And here is where im stuck. If the signup fails, i would like to present the user with the signup form again. One option would be to do a render "new", but that takes the user to

How to install ruby on rails in windows

匿名 (未验证) 提交于 2019-12-03 02:33:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Getting error while trying to install Ruby on Rails like below command Praveen@PraveenLaptop MINGW64 ~ $ gem install rails --no-ri --no-rdoc ERROR: Error installing rails: ERROR: Failed to build gem native extension. current directory: C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/nio4r-2.2.0/ext/ni o4r C:/Ruby25-x64/bin/ruby.exe -r ./siteconf20180224-8176-ibolzo.rb extconf.rb current directory: C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/nio4r-2.2.0/ext/nio4r make "DESTDIR=" clean 'make' is not recognized as an internal or external command, operable