ruby-on-rails-3.1

rails 3 associations error

江枫思渺然 提交于 2019-12-20 04:15:32
问题 I have a table pages and a table author. Each page belongs to one author. Created migrations for the tables and models as well. But getting this error while using it in form: NoMethodError in Pages#new Showing C:/rorapp/app/views/pages/_form.html.erb where line #1 raised: undefined method `build' for nil:NilClass Extracted source (around line #1): 1: <%= form_for(@page, @page.author.build) do |f| %> 2: <% if @page.errors.any? %> 3: <div id="error_explanation"> 4: <h2><%= pluralize(@page

Can't install therubyracer, error

痞子三分冷 提交于 2019-12-20 04:14:10
问题 I am trying to instal therubyracer/ therubyracer-heroku to my app, cause it doesn't work in heroku server cause I don't have javascript runtime enviroment. When I am trying to install these gems it writes: Installing therubyracer-heroku (0.8.1.pre3) with native extensions C:/RailsInsta ller/Ruby1.9.2/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::I nstaller::ExtensionBuildError) C:/RailsInstaller

How to manage rooms availability based on days or months occupation

烂漫一生 提交于 2019-12-20 04:13:58
问题 I'm developing a Rails 3 application (with MySQL as RDMS) to manage availability/occupancy for some Rooms (it's an hotel-like app) In my case, the problem is I've to keep up in the system 2 different requirements because one room can be rented for: Some months (for example 6 monts) Some days/weeks/weekend Clearly the app has to show for each room in a given date, if it is available or not, and which user is renting; and on the other side, one user can search one room for a given date range.

Rails 3.1, memory leak for missing local partial variables (Ruby 1.9.2-p290)

南楼画角 提交于 2019-12-20 03:34:37
问题 If I render a partial like so: = render :partial => "event_news_item", :object => event, :variable => true And then reference variable in the partial a memory leak is triggered. It seems rails goes into a recursion. I have to then quickly restart my server before memory usage spirals out of control. Anyone knows why the memory leak is triggered here? Can anyone confirm this on their machine? If I do = render :partial => "event_news_item", :object => event An error is raised correctly when

Rails 3.1, memory leak for missing local partial variables (Ruby 1.9.2-p290)

你说的曾经没有我的故事 提交于 2019-12-20 03:34:14
问题 If I render a partial like so: = render :partial => "event_news_item", :object => event, :variable => true And then reference variable in the partial a memory leak is triggered. It seems rails goes into a recursion. I have to then quickly restart my server before memory usage spirals out of control. Anyone knows why the memory leak is triggered here? Can anyone confirm this on their machine? If I do = render :partial => "event_news_item", :object => event An error is raised correctly when

Rails 3.1 Possible Bug in Asset Pipeline and Uglifier

谁说我不能喝 提交于 2019-12-19 22:16:23
问题 I ran into a problem deploying on Heroku do to a failure in the rake task rake assets:precompile At the bottom is the error I get if I integrate Rails 3.1 Jquery calendar: https://github.com/themouette/jquery-week-calendar Twitter bootstrap The error happens from uglifier. I suspect that problem could be related to the inclusion of many localizations for the calendar. I worked around the error by setting: # Compress JavaScripts and CSS config.assets.compress = false I was not able to examine

rake aborted! uninitialized constant Object::Country, why can't see model?

一世执手 提交于 2019-12-19 21:45:39
问题 I have rails 3.1, I am trying to populate data with seeds.rb I have a model Country which is migrated into a countries table But it seems that rails can't see Country model from seeds.rb I get this error: rake aborted! uninitialized constant Object::Country Tasks: TOP => db:seed my seeds.rb file looks like this: # encoding: UTF-8 Country.delete_all my Country model: class Country < ActiveRecord::Base has_many :students has_many :instructors end any idea please ? EDIT I am in development

uninitialized constant ActionView::CompiledTemplates::Category

寵の児 提交于 2019-12-19 16:54:50
问题 using this tutorial http://railscasts.com/episodes/57-create-model-through-text-field need to make it work in my app, was on rails 3.0.7 and it worked fine, updated it to 3.1.3 and I got this error now uninitialized constant ActionView::CompiledTemplates::Category I would look for answers more time but now I am really short on time. I have looked into most part of google results related to this problem and no good. Need help please. form <%= f.collection_select :category_id, Category.find(

There is a way to handle `after_save` and `after_destroy` “equally”?

依然范特西╮ 提交于 2019-12-19 13:04:07
问题 I am using Rails 3.1.0 and I would like to know if it is possible to handle after_save and after_destroy callbacks "equally". That is, I need to run same methods for both after_save and after_destroy callbacks. At this time I must handle those callbacks separately even if those accomplish to the same thing: after_save do |record| # Make a thing end after_destroy do |record| # Make the same thing as in the 'after_save' callback end So, there is a way to handle after_save and after_destroy

Install the mysql2 gem for a specific mysql client version?

丶灬走出姿态 提交于 2019-12-19 09:16:22
问题 I'm trying to use the mysql2 gem with rails 3.1.0.rc6, but I'm having some problem with my mysql client. I'm getting this message when trying to start my server. Incorrect MySQL client library version! This gem was compiled for 5.1.53 but the client library is 5.5.14. (RuntimeError) How do I compile/install mysql2 so that is can use mysql 5.5.14? I've tried using gem pristine mysql2 without success. 回答1: The problem here was that the MySQL2 gem was compiled for the MySQL version installed by