ruby-on-rails-3.1

Integrating CKEditor with Rails 3.2

人盡茶涼 提交于 2019-12-20 09:56:05
问题 Similar to Integrating CKEditor with Rails 3.1 Asset Pipline I am trying to integrate ckeditor with my rails 3.2 application. I have all ckeditor files copied under /app/assets/javascripts/ckeditor/* . I have the following lines in my application.js and application.js is included in my layout file: //= require jquery //= require jquery_ujs //= require ckeditor/ckeditor //= require_self Taken it from the answer to Integrating CKEditor with Rails 3.1 Asset Pipline I can understand that I need

rails 3.2.2 (or 3.2.1) + Postgresql 9.1.3 + Ubuntu 11.10 Connection error

一笑奈何 提交于 2019-12-20 09:45:55
问题 I am using PostgreSQL 9.1.3 (PostgreSQL 9.1.3 on x86_64-pc-linux-gnu, compiled by gcc-4.6.real (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1, 64-bit) and rails either 3.2.2 or 3.2.1 on ubuntu 11.10. Now, I can connect with below command with PostgreSQL su postgres enter password and I can see postgres=# I am placing below details in my config/database.yml and executing " rails db " it is working fine. development: adapter: postgresql encoding: utf8 reconnect: false database: sample_app_db pool: 5

Ruby on rails log file size too large

…衆ロ難τιáo~ 提交于 2019-12-20 09:29:22
问题 I stumbled to learn that my rails3.1 log file is super large, around 21mb. Is this, in terms of size normal? What the log file would like in the production environment? Besides, can I get rid of the log?thanks 回答1: you can just delete the file! Rails will create a new log if one doesn't exist. Obviously save / backup the file if it's important, but usually it's not. You can also zip the backuped up file (and then delete the source) if you want to keep it on the same drive but still save space

What's the correct syntax for remove_index in a Rails 3.1.0 migration?

ぐ巨炮叔叔 提交于 2019-12-20 09:09:30
问题 I'm in the process of adding Devise to an existing Rails app, with a Users table already defined. The devise generator pushed out the following migration: class AddDeviseToUsers < ActiveRecord::Migration def self.up change_table(:users) do |t| ## Database authenticatable t.string :email, :null => false, :default => "" t.string :encrypted_password, :null => false, :default => "" ## Recoverable t.string :reset_password_token t.datetime :reset_password_sent_at ## Rememberable t.datetime

Reflecting Heroku push version within the app

给你一囗甜甜゛ 提交于 2019-12-20 08:42:08
问题 Every time I push my app to heroku I see the line -----> Launching... done, v43 Is there a way to make that version number apear within the app so other people can see that number? 回答1: Why would you want to depend on running a command after every push? The accepted answer is worse than setting the config yourself. Instead add to your Gemfile: gem 'heroku-api' Add your App name and API key to the Heroku config: $ heroku config:add HEROKU_APP_NAME=myapp HEROKU_API_KEY=bp6ef3a9... Then put

Adding New Admins to Active Admin

狂风中的少年 提交于 2019-12-20 08:27:26
问题 I am using devise for my users. I recently installed the rails Active Admin gem, everything is working beautifully. However I can't figure out how to add a new admin users. I can see that active admin created an admin_user table in the db with a user admin@example.com, which I use to log in to the interface. I tried adding admin_user as a resource so that I can just click the Add Admin User button within the active admin interface to add a new user, however that does not seem to work. 回答1:

Method gives ActiveRecord::Relation error?

一个人想着一个人 提交于 2019-12-20 07:48:38
问题 I have 3 models called Price, UnitPrice and Purchase. The Price and UnitPrice models have an attribute called amount that I'm trying to scope to and get the total sum of both combined. I created two scopes, one for the total sum of both models. The other scope is to get the date attribute of both model's date fields. I'm trying to do this: <%= number_to_currency(current_user.purchases.today.total) But get the error: NoMethodError in pages#home undefined method `today' for #<ActiveRecord:

Rails 3 - Devise/ActionMailer/RUBY-SMTP causing a segmentation fault

大兔子大兔子 提交于 2019-12-20 05:57:09
问题 OK - I'm in way over my head here. I'm using: - ruby-1.9.3-p0 - rails-3.1.3 - mail-2.3.0 - devise-1.5.3 Trying to turn on Devise's :confirmable option and start up smtp services in my app. As soon as I add /config/initializers/setup_mail.rb , add Devise's necessary columns in my DB, and the :confirmable attribute to my User model, I get a segmentation fault. It occurs right after a user signs up. Devise is trying to send out the confirmation email, causing the ruby smtp library to crash with

Local server error after upgrading ruby from 1.8.7 to 1.9.2 (with Rails 3.1.1)

∥☆過路亽.° 提交于 2019-12-20 04:25:07
问题 I just installed rvm and upgraded ruby from 1.8.7 to 1.9.2 using rvm. I ran bundle install on my app, which re-installed my gems. When I run the rails server locally and navigate the browser to localhost:3000, the following error shows up in the server logs: Started GET "/" for 127.0.0.1 at 2012-01-25 20:10:12 -0800 TypeError (class Date needs to have method `_load'): Rendered /Users/nicks/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_trace

Local server error after upgrading ruby from 1.8.7 to 1.9.2 (with Rails 3.1.1)

穿精又带淫゛_ 提交于 2019-12-20 04:25:04
问题 I just installed rvm and upgraded ruby from 1.8.7 to 1.9.2 using rvm. I ran bundle install on my app, which re-installed my gems. When I run the rails server locally and navigate the browser to localhost:3000, the following error shows up in the server logs: Started GET "/" for 127.0.0.1 at 2012-01-25 20:10:12 -0800 TypeError (class Date needs to have method `_load'): Rendered /Users/nicks/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_trace