ruby-on-rails-3.2

Every time I tried to load gems for Jruby it gives me this error. This is after entering “gem install rails”. Help please?

非 Y 不嫁゛ 提交于 2019-12-11 11:40:36
问题 I am trying to download gems for jruby-1.7.0.RC2 but i get this error every time I try to push it through. Error: Your application used more stack memory than the safety cap of 2048K. Specify -J-Xss####k to increase it (#### = cap size in KB). Specify -w for full StackOverflowError stack trace 回答1: If you are using RVM to manage your Ruby runtimes, be sure to update it. See https://github.com/jruby/jruby/issues/331. 回答2: That because Everytime you run gem install rails it check for capsize

Rails 3.2 Merit Gem Badge not Working

拈花ヽ惹草 提交于 2019-12-11 11:28:36
问题 I've read all the current questions and answers about the Merit gem. And attempted to follow the solution given here Rails: Merit Gem Badge Not Registering or Displaying initializers/merit.rb: # Use this hook to configure merit parameters Merit.setup do |config| # Check rules on each request or in background config.checks_on_each_request = true # Define ORM. Could be :active_record (default) and :mongo_mapper and :mongoid config.orm = :active_record # Define :user_model_name. This model will

Ruby on Rails Controller action is a private method

让人想犯罪 __ 提交于 2019-12-11 11:28:11
问题 I am getting private method `new' called for Reminder:Class The Application trace is app/controllers/reminders_controller.rb:27:in `new' The new action is as follows def new @reminder = @current_user.reminders.build() @title = "New Reminder" respond_to do |format| format.html # new.html.erb format.json { render json: @reminder } end end The Reminder Model is has follows class Reminder < ActiveRecord::Base belongs_to :user belongs_to :assignment attr_accessible :datetime, :sent_at, :status,

ruby-ldap gem not work in rails3 app, but work in rails console

狂风中的少年 提交于 2019-12-11 11:18:28
问题 I want to build a rails3 website authed with LDAP, so I chose ruby-ldap gem (not net/ldap) which we used in our old rails2 apps and works very well. But I keep on getting weird error in rails3 app, See the codes below: require 'ldap' class WelcomeController < ApplicationController def index begin @test = LDAP::Conn.new('10.72.64.11', 389) rescue LDAP::Error p LDAP::Error end render :text => "ok" end end welcome#index is my root route. Most time, the app crashes when going to LDAP::Conn.new(

Easy way to detect whether rspec or cucumber is running?

感情迁移 提交于 2019-12-11 11:09:47
问题 I'm currently checking in some places whether code is being executed in test mode, by Rails.env.test? I would like to go one step further, and check whether it is Cucumber or Rspec executing the code, in order to finetune some methods for i18n (which I do want to run differently in a Cucumber context, but not in an Rspec context) Is there any way to do this? 回答1: You can set RAILS_ENV=cucumber and then ask: Rails.env.cucumber? 回答2: I'm using the cucumber-rails gem, and with that at least you

How to solve error “422:invalid authentication token” in Redmine

谁说胖子不能爱 提交于 2019-12-11 10:45:50
问题 In redmine I am getting 422:invalid authentication token and the logged in name is displayed with other user name instead of login user. There are no steps to reproduce. All of a sudden it occurs and it will be proper when I refresh the link. Please find the attached image for clear scenario. In the attached screenshot login user name is Pavithra but all of a sudden the logged in name will be displayed with other user name (Highlighted in green colour). 回答1: I ran into a similar issue for

Sorting parent menu items in activeadmin

萝らか妹 提交于 2019-12-11 10:26:30
问题 I have a menu, with multiple :parent items. With :priority I can sort the items within a drop down menu. How can I sort my main menu parent items? I'm using the latest version of activeadmin 回答1: I helped myself with a hack, I found: If you drop the following into the setup block of config/initializers/active_admin.rb. It uses the priority of the first displayable child menu item to indicate the sort priority for the parent item. class ::ActiveAdmin::Views::TabbedNavigation def priority_for

Rails - Dynamic routing based on host & ID

六眼飞鱼酱① 提交于 2019-12-11 10:03:03
问题 I have a rails application that contains many user pages. When a user wants to point a domain at this page, how would I do that? Right now I've tested out this, and it works - root :to => "controller#show", :id => 4, :constraints => {:host => "www.exampleurl.com"} but need to convert this to be dynamic, so that after I migrate a column into the model called domain it checks domain and serves it the proper ID. something like - root :to => 'controller#show', :id => ':id', :constraints => {:host

Indexing for Sphinx of legacy data generating some errors

可紊 提交于 2019-12-11 09:59:04
问题 A rails 3.2.18 application is being created, migrating data from a rails 2.3.10 application. Data is being ported over via pg_dump and loaded via psql command, without any errors. One model of the 13 that are indexed via thinking_sphinx is getting some errors. Only 1 in 8.5 docs is being indexed overall. indexing index 'norm_core'... ERROR: index 'norm_core': sql_range_query: ERROR: integer out of range (DSN=pgsql://jerdvo:***@localhost:5432/fna_development). total 1019 docs, 234688 bytes The

Rails: How to make has_many :through association work with Single Table Inheritance

假如想象 提交于 2019-12-11 08:14:51
问题 So in my current project I have an Article model that can have different kinds of Transactions. It has one main Transaction, but under certain circumstances it can have multiple sub-transactions. Until now I set it up like this: class Article < ActiveRecord::Base has_one :transaction, inverse_of: :article has_many :partial_transactions, through: :transaction, source_type: 'MultipleFixedPriceTransaction', source: 'PartialFixedPriceTransaction', inverse_of: :articles end class Transaction <