ruby-on-rails-3.1

Best deployment strategy for local used application in Rails 3.1 on Windows 7?

喜夏-厌秋 提交于 2019-12-13 01:25:05
问题 I am developing 2 applications in Rails 3.1 (will upgrade soon), and have noticed that my current strategy has its drawbacks. What I am doing currently is: Work directly on the development directory, have there version control with Git (which works perfect for me). I have defined the databases like (omitted not interesting parts): development: database: db/dev.db production: database: db/dev.db I have both applications running all the time in production mode, where the ports are defined as

CKEditor text area is blank in rails 3.1 app

旧城冷巷雨未停 提交于 2019-12-13 01:14:26
问题 I'm trying to embedd a ckeditor into a form and it just comes up blank. The text area is just an empty space where I expect to find an html editor window. I have a model where I want the "description" field to be html text. I thought it would be convenient to use ckeditor to edit it. I can't work out why the text field editor is not showing. I've got a rails 3.1 app, and I'm using the ckeditor gem (version 3.6.2). I've downloaded ckeditor and put it in my assets/javascripts folder. In my

Warbler not including ActiveSupport locale files

半腔热情 提交于 2019-12-13 01:08:22
问题 I am using Rails 3.1.3, JRuby 1.7.6, and Warbler 1.3.8 Note This was not happening when using JRuby 1.6.7 - but we recently tried to update the JRuby version, and that is when this issue started. We use Warbler to package our ruby on rails application into a WAR file. That process pre-compiles all the assets and everything works fine (seems to work fine, the command is successful) We then deploy the WAR file with our Software (which uses a JRuby environment - 1.7.6 - and uses Jetty as a web

Include namespace in Rails 3.1 console

不打扰是莪最后的温柔 提交于 2019-12-13 01:07:04
问题 My Rails 3.1 application is completely implemented inside a namespace. When I open the Rails console I would like to be able to directly access identifiers inside my namespace. I would like not to have to type the full qualified names everytime. Instead of Aef::Newman::HandledAddress I would like to write HandledAddress Including the namespace inside the console like the following does not help for some reason: include Aef::Newman 回答1: You can create an irb sub-session, "moving into" the

haml, blocks and partials

╄→гoц情女王★ 提交于 2019-12-13 00:39:18
问题 To clean and factor ugly views, I'd like to do the following: 1) In the view: = document_left_container do = document_information 2) In my helper: def document_left_container(&block) render partial: "/document_left_container", locals: { custom_block: block } end def document_information render partial: "document_information" end 3) Partials: For document_left_container: .foo = custom_block.call For document_information: .bar 4) The expected result: <div class='foo'> <div class='bar'> </div> <

Circular dependency error in SCSS file in Rails 3.1 asset pipeline

我们两清 提交于 2019-12-12 20:26:15
问题 I've got application.css.scss in my assets/stylesheets directory, along with a number of controller-specific scss files. The application.css.scss file has *= require_self *= require_tree . And I have some ordinary scss following these directives. When both require statements are enabled, I get "/app/assets/stylesheets/application.css.scss has already been required." (There is no application.css , I've double-checked.) Commenting out the *require_tree .* line eliminates the error, but

What's the best UJS way of refactoring link_to_function?

前提是你 提交于 2019-12-12 20:15:22
问题 I have the following interface for a baseball-draft oriented hobby project of mine that lets a team owner build a set of criteria to rank players on: Clicking the attributes will add that attribute to the list, give it an importance factor and a sort direction. In Rails 2 and Rails 3 (with the prototype helpers) - I did this by having the following: <div class="rankingvaluecloud"> <ul> <% @rankingattributes.each do |attributename| %> <li><%= add_ranking_attribute_link(attributename) %></li> <

schema.rb index different from individual migration index

拟墨画扇 提交于 2019-12-12 19:09:43
问题 I have this for my migration: class CreateCategories < ActiveRecord::Migration def up create_table :categories do |t| t.integer :parent_id t.string :title, :null => false end execute('CREATE UNIQUE INDEX ix_categories_root_title ON categories (title) WHERE parent_id IS NULL') end def down drop_table :categories end end But when I peeked into db/schema.rb I saw this instead: ActiveRecord::Schema.define(:version => 20110808161830) do create_table "categories", :force => true do |t| t.integer

Rails 3: Execute initializer only for server start

家住魔仙堡 提交于 2019-12-12 18:07:54
问题 I'm working on a Rails 3.1 application that needs to start up a couple of background processes when the application server starts: (1) A filesystem monitor process using FSSM to monitor files in a certain directory, and (2) a Resque "worker" process that executes jobs from a Resque queue. In my initial attempt at this, I have done this by spawning the processes in an initializer in the config/initializers directory. This works fine in the sense that the processes are correctly started and

NoMethodError in Posts#new

送分小仙女□ 提交于 2019-12-12 17:50:34
问题 I'm doing the Getting started with Rails tutorial and when I run the local server from shell I get this: `NoMethodError in Posts#new` `/_form.html.erb where line #1 raised: `undefined method `model_name' for NilClass:Class That is the extracted source (around line #1): 1: <%= form_for @post do |f| %> 2: <% if @post.errors.any? %> 3: <div id="errorExplanation"> 4: <h2><%= pluralize(@post.errors.count, "error") %> prohibited I just started on Ruby on Rails and I can't figure out what is