ruby-on-rails-3.2

Is it possible to skip the asset precompile step for a single git push on Heroku?

本小妞迷上赌 提交于 2019-11-30 03:43:25
Every time I deploy my Rails 3.2 project to Heroku, rake assets:precompile is run: $ git push heroku master ... ----> Preparing app for Rails asset pipeline Running: rake assets:precompile Asset precompilation completed (189.17s) ... Sometimes I want to make a push that I know does not change any assets, such as a quick hotfix to a controller. Is it possible to skip the asset:precompile step for a single git push to Heroku? Thanks. Sure! You'll need to create a manifest.yml in your_app/pubilc/assets directory. The file can be blank. But ideally, you precompile everything locally, so deploys to

No 'Access-Control-Allow-Origin' header is present on the requested resource

我与影子孤独终老i 提交于 2019-11-30 03:23:36
I am using omniauth-facebook with AngularJS and CORS is not working correctly . My omniauth.rb is Rails.application.config.middleware.use OmniAuth::Builder do provider :facebook,"xxxxx", "xxxxx", :scope => 'email,user_birthday,read_stream', :display => 'popup' end Everything works if i use it as rails app and request. But when i try to call 'http:\localhost:3000\users\auth\facebook" via Angular JS $http.get('/users/auth/facebook').success(function(data, status, headers, config) { console.log("back in success"); }). error(function(data, status, headers, config) { }); } i see following error in

Uploading a remote file url from Rails Console with Carrierwave

江枫思渺然 提交于 2019-11-30 03:14:15
I just wanted to know how one would go about uploading a remote file url using Carrierwave in the Rails console. I tried the following without any luck. I presume it's not processing the Uploader? user = User.first user.remote_avatar_url = "http://www.image.com/file.jpg" user.save Many thanks Take a look at the ' Uploading files from a remote location ' section on this page https://github.com/carrierwaveuploader/carrierwave CarrierWave should throw an error if the url of the location is invalid 2.1.3 :015 > image.remote_image_url = "http" => "http" 2.1.3 :016 > image.save! (0.2ms) BEGIN (0.2ms

rake assets:precompile attempting to connect to database

徘徊边缘 提交于 2019-11-30 02:47:43
I'm attempting to debug why my application is attempting to connect to my database when I run rake assets:precompile --trace . I'm probably missing something in the stack trace...anyone see the pertinent line? DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionController::Base instead. (called from <top (required)> at /Users/Kyle/Desktop/skateparks-web/config/application.rb:4) ** Invoke assets:precompile (first_time) ** Execute assets:precompile /Users/Kyle/.rvm/rubies/ruby-1.9

rails generate model

自古美人都是妖i 提交于 2019-11-30 02:39:13
I'm trying to follow instructions from the book "Head First Rails" and on page 50 it says to create a model but I am unable to create a model using the rails command. When I type this at this prompt: localhost:~ home$ rails generate model ad name:string description:text price:decimal seller_id:integer email:string img_url:string I get this: Usage: rails new APP_PATH [options] Options: -r, [--ruby=PATH] # Path to the Ruby binary of your choice # Default: /Users/home/.rvm/rubies/ruby-1.9.3-p125/bin/ruby -b, [--builder=BUILDER] # Path to a application builder (can be a filesystem path or URL) -m,

How to setup bootstrap-datepicker-rails?

倖福魔咒の 提交于 2019-11-30 02:00:01
问题 Anybody knows how to setup the gem bootstrap-datepicker-rails? I followed the steps in http://rubydoc.info/gems/bootstrap-datepicker-rails/0.6.21/frames, basically: I setup twitter-bootstrap-rails gem I add this to gemfile gem 'bootstrap-datepicker-rails', '>= 0.6.21' Add this line to app/assets/stylesheets/application.css *= require bootstrap-datepicker Add this line to app/assets/javascripts/application.js //= require bootstrap-datepicker Add this line to app/assets/javascripts

ruby on rails add a column after a specific column name

房东的猫 提交于 2019-11-30 01:15:07
问题 I tried to add a column to a table after a specific column in the table. Here is what I did: rails generate migration add_reaction_id_to_patient_allergies reaction_id: integer :after => 'patient_id' Here is what my migration file looks like: class AddReactionIdToPatientAllergies < ActiveRecord::Migration def change add_column :patient_allergies, :reaction_id, :string add_column :patient_allergies, :integer, :string add_column :patient_allergies, :, :after add_column :patient_allergies, :=,

Gem Vs Plugin Vs Engine in Ruby on Rails

邮差的信 提交于 2019-11-30 00:15:16
问题 What is difference between Gem package, plugin and Engine in Ruby on Rails ? I think we use plugin before Rails3.2 and after rails3.2 is release we are using gem package as plugin but how can we use engine in ROR ? 回答1: Plugins as you knew them from Rails 2 (i.e. plugins under the vendor/plugins folder) were deprecated for Rails 3.2; support for it was completely removed in Rails 4. Now, there's a concept of a "gemified plugin" where the plugins are essentially built as gems, and can be

Custom text for rails form_for label

∥☆過路亽.° 提交于 2019-11-30 00:12:02
I want to display a label in form_for : <div class="field"> <%= f.label :name %><br /> <%= f.text_field :name %> </div> This generates the label "Name", but I want it to be "Your Name". How can I change it? The second parameter to label helper will allow you to set custom text. <%= f.label :name, 'Your Name' %> Use Ruby on Rails Documentation to look up helper methods. You can specify custom label text via i18n. In config/locales/en.yml , and assuming your user model is named user , you can add the following: helpers: label: user: name: Your Name This will allow you to keep using <%= f.label

What is the purpose of vendor/bundle? Heroku tells me to remove it

怎甘沉沦 提交于 2019-11-29 23:01:44
Upon pushing some changes to Heroku, I noticed a warning about vendor/bundle (see WARNING below). What is the purpose of this directory if, according to the warning, it should be "removed" from Git tracking? Why isn't vendor/bundle automatically .gitignore 'd by default by Rails? Should I run bundle pack ? (Is it actually bundle package ??) What are the pros and cons around bundle pack (relative to both development and production )? To make this even more confusing, there's a popular blog post, by Ryan McGeary, titled "Vendor Everything" Still Applies that strongly argues for running bundle