ruby-on-rails-3.1

Assets say “not precompiled” when they are precompiled

久未见 提交于 2019-11-30 13:45:59
问题 Ok so, I'm getting this error when I try to use the asset pipeline. I don't understand what's causing it. Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPrecompiledError in Photos#show Showing .../app/views/photos/_photo_view.html.haml where line #2 raised: jquery.autocomplete isn't precompiled Extracted source (around line #2): 1: - content_for :scripts do 2: = javascript_include_tag 'jquery.autocomplete' However, this IS precompiled. I ran rake assets:precompile RAILS_ENV=production

Precompiling a .scss manifest file using Rails 3.1's asset pipeline

混江龙づ霸主 提交于 2019-11-30 13:43:20
问题 The release version of Rails 3.1 is having some weird issues with precompiling a sass manifest file with the extension scss . The weird thing is that the default manifest file application.scss compiles fine and I see it under public/assets/ . However when I try to compile my custom manifest files, nothing is created. I have enabled the precompile option in the production config. config.assets.precompile += %w( user.scss admin.scss ) I am running the precompile rake task correctly as far a I

omniauth OAuthException & OAuth::Unauthorized

爱⌒轻易说出口 提交于 2019-11-30 13:41:24
I have installed omniauth 1.0. Also I have oauth-0.4.5, oauth2-0.5.1, omniauth-facebook-1.0.0, omniauth-twitter-0.0.6. omniauth.rb Rails.application.config.middleware.use OmniAuth::Builder do provider :developer unless Rails.env.production? provider :facebook, ENV['167257285348131'], ENV['c8c722f697scb2afcf1600286c6212a9'], :scope => 'email,offline_access,read_stream', :display => 'popup' provider :twitter, ENV['fma2L22ObJCW52QrL7uew'], ENV['4aZfhCAOdiS7ap8pHJ7I1OZslFwVWWLiAMVpYUI'] end session_controller.rb class SessionsController < ApplicationController require 'omniauth-facebook' require

Devise install from existing model/database

痞子三分冷 提交于 2019-11-30 13:28:12
I am wondering how can i add devise to an existing database with a different user. Here I already have a customer model define and I want to change to allow devise to work on it. I have created a new migration and inserted the code has follow class AddDeviseToCustomer < ActiveRecord::Migration def change change_table :customers do |t| #t.database_authenticatable t.string :encrypted_password, :null => false, :default => '', :limit => 128 t.confirmable t.recoverable t.rememberable t.trackable t.token_authenticatable t.timestamps end end end According to this it should work. https://github.com

Devise skip_confirmation! fails to avoid to send the confirmation instructions

冷暖自知 提交于 2019-11-30 13:17:57
问题 My app is set up so that if a user signs in with Oauth or Openid, they don't have to confirm their email address. However, Devise is still sending email confirmations. When I call User.skip_confirmation! I get an undefined method error. My model: class User < ActiveRecord::Base devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable, :lockable, :token_authenticatable, :omniauthable attr_accessible :username, :email, :password,

Carrierwave add a watermark to processed images

。_饼干妹妹 提交于 2019-11-30 12:32:26
问题 Im trying to add a watermark to processed images with below code I got from several resources: def watermark manipulate! do |img| logo = Magick::Image.read("#{Rails.root}/assets/images/watermarks/watermark.png").first img = img.composite(logo, Magick::SouthEastGravity, Magick::OverCompositeOp) end end Only problem is, you guess it, does not work. I get no errors in log/console whatsoever This is my method inside my uploaded and called like: def function version :thumb do process :resize_to

What is the value of Compass for Rails 3.1?

不羁岁月 提交于 2019-11-30 11:22:38
问题 I'm trying to decide if I should include Compass when starting a new Rails 3.1 project. I haven't used Compass before. Rails 3.1 now supports SCSS directly. The Rails 3.1 asset pipeline (via sprockets) now compiles stylesheets automatically. And I can use a SCSS version of a CSS framework such as Blueprint directly. What benefits will I get from using Compass with Rails 3.1? 回答1: Bourbon (by Thoughtbot) is a light alternative to compass that integrates well with rails 3.1. It has the main

How to add sequences to a migration and use them in a model?

限于喜欢 提交于 2019-11-30 11:09:53
I want to have a " Customer " Model with a normal primary key and another column to store a custom "Customer Number". In addition, I want the db to handle default Customer Numbers. I think, defining a sequence is the best way to do that. I use PostgreSQL. Have a look at my migration: class CreateAccountsCustomers < ActiveRecord::Migration def up say "Creating sequenze for customer number starting at 1002" execute 'CREATE SEQUENCE customer_no_seq START 1002;' create_table :accounts_customers do |t| t.string :type t.integer :customer_no, :unique => true t.integer :salutation, :limit => 1 t

Persisting SCSS variables in rails asset pipeline?

坚强是说给别人听的谎言 提交于 2019-11-30 11:08:30
I'm upgrading a rails app with lots of SCSS stylesheets to use the asset pipeline, and need to include some global variables and mixins for each file. Adding several @import directives at the top of every file isn't very DRY, so I'd like to do something like this: # application.css /* *= require variables *= require mixins *= require_tree . */ This doesn't work of course, because the variables are not persisted across files. Anyone know how to achieve this? Adam Bowen The default manifest syntax isn't powerful enough to give you useful Sass features like shared variables, mixins, etc. Instead,

Library not loaded: /usr/local/lib/libpq.5.4.dylib

余生长醉 提交于 2019-11-30 10:44:31
I am working on a rails app. Installed Postgresql using postgresql-9.1.2-1-osx.dmg Installed pg gem. Then when I executed rake db:create getting the following error - dlopen(/Users/sathishvc/.rvm/gems/ruby-1.9.3-head@knome-vivacious/gems/pg-0.12.2/lib/pg_ext.bundle, 9): Library not loaded: /usr/local/lib/libpq.5.4.dylib Checked if /usr/local/lib/libpq.5.4.dylib exists or not. It does not. So, it should be existing somewhere else in the system or I do not know, if I need to install any other piece of software for this. Advice anyone please? if you have upgraded PostgreSQL with homebrew (brew