gem

Load Ruby gem into a user-defined namespace

风格不统一 提交于 2020-01-01 08:52:49
问题 Given a gem that defines top-level classes that clash with some code I have written, is it possible to require the gem in such a way that all its classes are grouped inside a module I can define? For example, if an unsafe_gem defines a class: class Word # ... some code end I would need something like: class Word # My word class. end module SafeContainer # This obviously doesn't work # (i.e. the gem still defines ::Word). require 'unsafe_gem' end So that I can distinguish between: Word.new # =

Rails Devise thrown 302 error for non confirmed user

不羁岁月 提交于 2020-01-01 06:30:07
问题 I have integrated the devise for coaches login in ROR site. It is working fine but when I tried to login through a user who is not confirmed yet it thrown 302 error. Here are the details of the code I have used: 1) Database Schema: create_table "coaches", :force => true do |t| t.string "first_name", :limit => 20 t.string "last_name", :limit => 20 t.integer "status", :limit => 2, :default => 0 t.datetime "created_at" t.datetime "updated_at" t.string "email", :default => "", :null => false t

rbenv and bundler: “bad interpreter: No such file or directory”

不问归期 提交于 2020-01-01 04:18:55
问题 I messed up my configuration. I am running Ubuntu 14.04 and had some issues when I tried to move from a project to an other. I tried to uninstall and reinstall rbenv and then installed Ruby 2.1.7 following this guide: https://gorails.com/setup/ubuntu/14.04. Now, when I run gem install bundler nothing happens and I can't install any gems. When I type bundler or bundler -v I see this: /usr/local/bin/bundler: /usr/bin/ruby1.9.1: bad interpreter: No such file or directory I spent many hours

RESTful login with devise (Rails 4)

拟墨画扇 提交于 2020-01-01 03:40:06
问题 How do I do RESTful sign-up and sign-in using devise in Ruby on Rails (I am using version 4)? I could not find any documentation with regards to the parameters (e.g. email, password) that I should POST to the server. It seems that RESTful login using JSON data (e.g. via AJAX) is not supported out of the box in the current version of devise - the default behavior is to send back a whole HTML page for any type of request made, instead of a JSON object for handling JSON request specifically.

Rails: Options for build bundler gemfile

此生再无相见时 提交于 2020-01-01 02:44:09
问题 I have a gem, that must be build with some options. gem install pg --with-pg-include=/Library/PostgreSQL/9.0/include/ --with-pg-lib=/Library/PostgreSQL/9.0/lib/ Can I include this options in the Gemfile? In my Gemfile the pg command is gem "pg", "0.12.2" I want to provide some options after the version number. thx, tux 回答1: Here is the relevant text from the link posted in comments already: BUILD OPTIONS You can use bundle config to give bundler the flags to pass to the gem installer every

Heroku rejecting push in mature application (pre-receive hook declined)

怎甘沉沦 提交于 2020-01-01 01:09:36
问题 I'm getting FAILED: http://devcenter.heroku.com/articles/bundler ! Heroku push rejected, failed to install gems via Bundler To git@heroku.com:... ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to ………….. (see bottom for full listing) This is an application that is currently working on heroku, but heroku won't allow git push heroku master to update the code. However, if I clone the code to a new folder and do a heroku create to create a new app

memorable name generator gem for ruby

流过昼夜 提交于 2019-12-31 17:37:55
问题 Before I go roll my own and start pulling out the dictionary, does anyone know a rubygem to generate memorable names suitable for app keys. I need something pronounceable so that I can give users unique email addresses to submit content to. I like Heroku's naming for it's apps as an example. floating-sky-58 simple-fog-45 回答1: You can use randexp gem. It's use the dictionnary from your OS ( UNIX only ) with randexp gem you can do something like : /[:word:]-[:word:]-\d+/.gen and have like

How to fix libv8 error from Gemfile on Mavericks?

旧巷老猫 提交于 2019-12-31 12:41:31
问题 When I run bundle install I get An error occurred while installing libv8 (3.11.8.17), and Bundler cannot continue. Make sure that `gem install libv8 -v '3.11.8.17'` succeeds before bundling. Libv8 is dependency for lunchy and therubyracer gems. I have locked in my Gemfile.lock libv8 gem on 3.11.8.17 But I found that I can downgrade it to 3.3.10.4 bundle install / update: libv8 (therubyracer) installation fails (with native extensions) How to do that? I also found working 3.11.8.17 gem but don

Could not locate Gemfile after executing “bundle install”

雨燕双飞 提交于 2019-12-31 03:14:11
问题 Hey, I am completely new to Rails and just started created my first Project, following the Steps of a tutorial. I created the new Project using: rails myapp . Then I should execute bundle install , this did not work because bundler has not been installed, after an Update on Gems and installing bundler I have been able to execute bundle install , but every time I receive: Could not locate Gemfile I checked my project dir, it is true there is no Gemfile, but should this be created automatically

Unable to install MySQL on Mac OS X

余生颓废 提交于 2019-12-30 09:32:26
问题 I'm having the exact issue as described in this question: MYSQL Installation Troubles. Unfortunately none of the answers helped me (and it's closed). I try to learn Ruby on Rails and don't get MySQL working (so it is programming related). I typed: rake db:create and got: !!!The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql. rake aborted! no such file to load -- mysql (See full trace by running task with --trace) HD