rubygems

Modify Rack App

回眸只為那壹抹淺笑 提交于 2019-12-11 15:36:31
问题 For one of my ruby applications i need the server to route requests based on the subdomain. There are ways to do this using other gems but i decided to make my own "middleware". This code runs applications based on where the request is going to. config.ru require './subdomain' require './www' run Rack::Subdomain.new([ { :subdomain => "test", :application => Sinatra::Application } ]); subdomain.rb module Rack class Subdomain def initialize(app) @app = app end def call(env) @app.each do |app|

DoubleRenderError (Render and/or redirect and adding 'and return' at the end of redirect_to or self.render

帅比萌擦擦* 提交于 2019-12-11 15:23:15
问题 I have a messaging system every time I insert a message into the database. it insert duplicates im getting AbstractController::DoubleRenderError (Render and/or redirect were called multiple times in this action) . I tried to add and return at the end of redirect_to or self.render but it did not help. the problem it seems to be happening from the create method # app/controllers/messages_controller.rb class MessagesController < ApplicationController before_action :authenticate_user! before

Anyone can think of any way to customize Email( Mailboxer gem's) template view on rails3?

南楼画角 提交于 2019-12-11 14:26:33
问题 I'm currently using gem called "Mailboxer" on rails3. Everytime, mailboxer delivers email, and it seems it's using the template shown below. Anyone knows how to customize this template? Even though you install mailboxer, views won't be produced so that you can't customize it! You have a new message: subject You have received a new message: Body 回答1: rails g mailboxer:views Will generate the view files you need so you can edit them. 来源: https://stackoverflow.com/questions/11303303/anyone-can

What to do about failed native extension builds in gem on Windows?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 13:59:20
问题 A couple of Rails applications I downloaded have dependencies on bson_ext which appears to be a native code library. When I run rake gems:install for the app I get the following error message: ERROR: Error installing bson_ext: ERROR: Failed to build gem native extension. d:/Ruby187/bin/ruby.exe extconf.rb checking for asprintf()... no checking for ruby/st.h... no checking for st.h... no checking for ruby/regex.h... no checking for regex.h... no checking for ruby/encoding.h... no creating

Using the Rails gem 'Mailboxer' and the sender_id is always zero

倾然丶 夕夏残阳落幕 提交于 2019-12-11 13:55:07
问题 Just integrated Mailboxer and I'm running into one problem. When I send a new message the sender_id in the mailboxer_notifications table is always zero instead of the id of the sender. I'm using the friendly_id gem for usernames and I think this is where the problem is but I cant find out how to fix it (if it even is the problem). messages/new.html.erb <% provide(:title, "New Message") %> <%= form_tag user_messages_path, method: :post do %> <div class="form-group"> <%= label_tag 'message

Error compiling Compass LoadError on line [“179”] .. data.rb: Cannot load such file

♀尐吖头ヾ 提交于 2019-12-11 13:23:11
问题 I've trawled every possible Ruby resource looking for a solution to this error but can't for the life of me figure out what I'm doing wrong. I'm trying to get my sass compiler working for a Drupal build from a previous project. Using the following stack: Ruby 2.3.0, Sass 3.4.22, Compass & Compass Core 1.0.3, Bundler 1.11.2. I've already tried uninstalling and reinstalling the gems but to no avail. The error occurs when I run the bundle exec compass watch command, which results in the

Could not find gem 'rails x86-mingw32'

不问归期 提交于 2019-12-11 13:11:24
问题 I'm doing the Rails Tutorial by Michael Hartl and I ran into this problem when trying to run the rails server. This is is my gem file gem 'rails', '4.1.5' gem 'sqlite3' gem 'sass-rails', '~> 4.0.3' gem 'uglifier', '>= 1.3.0 gem 'coffee-rails', '~> 4.0.0' gem 'jquery-rails' gem 'turbolinks' gem 'jbuilder', '~> 2.0' gem 'sdoc', '~> 0.4.0', gem 'tzinfo-data', platforms: [:mingw, :mswin] 回答1: try gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw] 来源: https://stackoverflow.com/questions

ruby-audio 1.6.1 install error (with installed Libsndfile 1.0.25)

寵の児 提交于 2019-12-11 12:48:14
问题 Please help me to install ruby-audio 1.6.1 ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux] Libsndfile 1.0.25 already installed. Here is log: gem install ruby-audio-1.6.1.gem Building native extensions. This could take a while... ERROR: Error installing ruby-audio-1.6.1.gem: ERROR: Failed to build gem native extension. /usr/bin/ruby1.9.1 extconf.rb checking for sndfile.h in /opt/local/include,/usr/local/include,C:/Program Files (x86)/Mega-Nerd/libsndfile/include,C:/Program Files/Mega

RSpec can't find Cucumber gem

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 12:38:50
问题 When running rspec I get the following error: no such file to load -- cucumber-rails /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in `require' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:208:in `load' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `load

How can I develop two gems together with Bundler?

馋奶兔 提交于 2019-12-11 12:37:28
问题 I am developing two gems, let's call them foo and bar. Also foo has a runtime dependency on bar. I am developing both these gems with bundler. How can I specify bar as a dependency of foo and have bundler resolve that dependency to a local path, without polluting my Gemfile? At the moment the only way I can see to do this is to put gem "bar", path: "path/to/bar" in foo's Gemfile, and remove it once bar is on rubygems, but this solution is obviously unsatisfactory as it will break on anybody