ruby-on-rails-3

Heroku Precompiling Assets Failed

喜欢而已 提交于 2019-12-24 07:58:34
问题 My app is suddenly not working after an update. Not sure what's going wrong. Basically, when I push to heroku, I get these errors: Precompiling assets failed, enabling runtime asset compilation Injecting rails31_enable_runtime_asset_compilation And a little higher up: rake aborted! Unexpected token: operator (>) (line: 19073, col: 9, pos: 605247) Error at new JS_Parse_Error (/tmp/execjs20121211-811-1z5vum.js:1720:22) at js_error (/tmp/execjs20121211-811-1z5vum.js:1728:15) at croak (/tmp

Weird route malfunction, mix between devise and own controller

為{幸葍}努か 提交于 2019-12-24 07:58:01
问题 I've got a real weird route behavior. I spotted the line which, i think, cause the error. Here is the line (in application.html.erb) in question : <%= link_to "Official Top", :controller => "tops", :action => "show", :id => 10 %> The problem happens when i want to sign in with devise, when i go to this link : http://localhost:3000/users/sign_in using <%= link_to "sign in", new_user_session_path %> Without the line everything is fine, but when the line is present i've got this error : No route

Update attribute in callback Rails 3

感情迁移 提交于 2019-12-24 07:15:18
问题 Following on from this question, I have spent the day trying to add a cumulative running sales total to my sales table. It's a bit tricky (for me) because I want a running total for sales where the isbn_id is the same, and, within that set, records where the channel_id is the same - ranked by invoice_date. This is all so I can calculate royalties on a particular range of units sold. Here's my non-working callback code, in the Sale model: before_save :runningtotal private def runningtotal

failed to allocate memory on the console and internal server error on the browser

不问归期 提交于 2019-12-24 07:09:42
问题 I have this error while loading the data from files in to database. Please help me out in getting this right. here is the method : clusters.each do |cluster| cluster_path = cluster.path root = current_root + cluster.name+'/' Log.info "<br/> --------- Starting data popuation for #{cluster_path} ---------------" population_time[:bp_data] = populate_bp_data(root+fileName[:bp_data], cluster_path, @dataset.id) population_time[:m_lint] = populate_m_lint(root+fileName[:m_lint], cluster_path,

Ruby on Rails/will_paginate: Ordering by custom columns

限于喜欢 提交于 2019-12-24 06:45:55
问题 I've got a rather complicated SQL-Query whose results should be paginated and displayed to the user. I don't want to go into details here, but to put it simple I just select all columns of a model, and an additional column , that is used just for sorting purposes. Note.select( ['notes.*', "<rather complicated clause> AS 'x'"] ).joins(...)... After some .join()'s and a .group() , I finally call .order() and .paginate on the relation. If I order by any of the model's natural columns everything

SSL Error OmniAuth in Ruby on Rails

坚强是说给别人听的谎言 提交于 2019-12-24 06:44:53
问题 I've read a lot about this error especially in OmniAuth for Rails 3. I have a few questions because currently I'm stuck on it. The consensus in this post was that it couldn't reference the certs properly. My first question is this (I'm using Windows 7 to preface the question): Where exactly in my hard drive would I begin to look to find the certs? I used RailsInstaller to install Rails 3 and the only thing that I can find that is close to that location is in "Git" where there is a "cert"

How to disable Rails sessions for web crawlers?

孤街醉人 提交于 2019-12-24 06:41:57
问题 It used to be that a line like this in the application controller would disable sessions entirely for a request: session :off, :if => Proc.new {|req| req.user_agent =~ BOT_REGEX} With Rails 3.x, this is either deprecated or no longer works. I realize that the new concept is that sessions are lazy loaded, but the execution flow through the app uses/checks sessions even if it's a web bot. So is there some new mechanism that could be used to disable sessions on a per-request basis? 回答1: There

Rails namespaces and routing

房东的猫 提交于 2019-12-24 06:40:39
问题 I need help. I want administration for my rails application. I tried to set the routes with namespaces, but namespaces require a resource, and resource must have id in get request. Anybody know how to set up correctly? I using windows machine. Thanks. My routes : Web::Application.routes.draw do namespace :admin do resources :access # GET http://localhost/admin/access/login/login - stupid?? end match ':controller(/:action(/:id))(.:format)' end 回答1: Try to use resource :access instead of

Cucumber duplicate class problem: AssociationTypeMismatch

我的未来我决定 提交于 2019-12-24 06:39:05
问题 I am having a problem with Cucumber when there is a reference to self in a model callback method. Code example below. The error is like: Person(#26738680) expected, got Person(#29003170) (ActiveRecord::AssociationTypeMismatch) class Person < ActiveRecord::Base has_one :person_profile accepts_nested_attributes_for : person_profile after_create :new_person_profile private def new_person_profile person_profile = PersonProfile.new( ..., :person => self # <--- this causes the error in cucumber )

ERROR: Could not find a valid gem 'rails' (>= 0) in any repository

不打扰是莪最后的温柔 提交于 2019-12-24 06:35:40
问题 I installed rvm and ruby successfully in a linux environment. When I try to install rail, that time I face following error: $ gem install rails /home/bathakarai/.rvm/rubies/ruby-1.9.3-p385/bin/gem:4: warning: Insecure world writable dir /home/bathakarai in PATH, mode 040777 ERROR: Could not find a valid gem 'rails' (>= 0) in any repository ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) Errno::EHOSTUNREACH: No route to host - connect(2) (http://rubygems.org/latest_specs.4.8.gz