ruby-on-rails-3.1

redirecting from http://example.com to https://example.mysite.com

拥有回忆 提交于 2019-11-30 07:57:29
This question has been asked in various permutations, but I haven't found the right combination that answers my particular question. The configuration Rails 3.1 (allowing me to use force_ssl in my ApplicationController ) Hosted on Heroku Cedar (so I can't touch the middleware) My SSL certs are registered for secure.example.com I've already added force_ssl to my ApplicationController, like this: # file: controllers/application_controller.rb class ApplicationController < ActionController::Base protect_from_forgery force_ssl end The problem Currently, if a user navigates to http://example.com ,

Asset pipeline, compass font-face and eot?iefix call to the font

余生颓废 提交于 2019-11-30 07:35:52
I am trying to use a Compass font-face mixin, which contains the inclusion of *.eot?iefix My app/assets/fonts contains all the font types needed, including .eot. When I try to run assets:precompile the task fails saying something like: webfont.eot?iefix isn't precompiled Do you know the possible solution for this problem? It runs with no error in case I have config.assets.compile = true, but as I've understood it's better not to use it on production. You can do it with pure Scss too: @font-face { font-family: 'DroidSans'; src: url(font-path('DroidSans-webfont.eot')); src: url(font-path(

getting error after ugrading to sass-3.1.8

我怕爱的太早我们不能终老 提交于 2019-11-30 07:31:59
问题 after upgrading to sass-3.1.8 form sass-3.1.7 I get this error: Functions may only be defined at the root of a document. any Idea how I can solve this? I'm using some of bourbon's mixins and it's imported at the top of my stylesheets, that's all. 回答1: I have the same problem and could not solve it by modifying code. The way I solved was to use an older version: gem uninstall sass gem install sass -v 3.1.1 回答2: Ok Here is what I come up with: SASS team decided to make a change (in this case

Upload images in database

a 夏天 提交于 2019-11-30 07:20:36
问题 I want save uploaded images in a bytea column in my PostgreSQL database. I'm looking for advice on how to how to save images from Rails into a bytea column, preferably with examples. I use Rails 3.1 with the "pg" driver to connect to PostgreSQL. 回答1: It's often not a good idea to store images in the database its self See the discussions on is it better to store images in a BLOB or just the URL? and Files - in the database or not?. Be aware that those questions and their answers aren't about

Rails 3 automatic asset deployment to Amazon CloudFront?

不羁岁月 提交于 2019-11-30 07:01:17
Is there a gem or method available in Rails 3.1 that can upload assets to amazon cloud front automatically and use those instead of serving locally hosted ones? I guess it's easy to upload compiled assets manually and then change the rails app config to use that asset host, but when an asset is modified, the uploads to cloud front would need to be done manually again. Any good ways out there for this? Definitely check out asset_sync on github. Or our Heroku dev centre article on Using a CDN asset Host with Rails 3.1 on Heroku . There is quite a big performance improvement in using asset_sync

Integrating CKEditor with Rails 3.1 Asset Pipline

一笑奈何 提交于 2019-11-30 06:47:05
问题 I'm new to the Asset Pipeline, having just migrated over from Rails 3.0. I'm trying to get CKEditor into the pipeline, but all the gems for it are really unclear about how they work, and have little or no usage instructions. I would prefer to do this without using a gem, since it seems that all I have to do is drop the source files into the vendor/assets directory and then include them in application.js . I've tried that, however, when I precompile and push to production, it seems that some

How to remove “bundle install” command during the project creation in Rails 3.1?

心已入冬 提交于 2019-11-30 06:14:55
I am creating a new project: rails new ggg --database=mysql and get following output: create create README create Rakefile create config.ru create .gitignore create Gemfile create app create app/assets/images/rails.png create app/assets/javascripts/application.js create app/assets/stylesheets/application.css create app/controllers/application_controller.rb create app/helpers/application_helper.rb create app/mailers create app/models create app/views/layouts/application.html.erb create app/mailers/.gitkeep create app/models/.gitkeep create config create config/routes.rb create config

How to create schema in sql

故事扮演 提交于 2019-11-30 06:12:40
As per http://edgeguides.rubyonrails.org/configuring.html and this post I have this in application.rb config.active_record.schema_format = :sql However, it's still creating db/schema.rb (even after I delete it) and more importantly it's not creating the schema in sql when I run "rake db:migrate". Anyone know what I'm doing wrong? I'm on Rails 3.1 pre. Well, this could be a rails bug, but you can always generate your db structure with this: rake db:structure:dump This is going to generate an "#{Rails.env}.sql" file for you with your database structure in SQL. 来源: https://stackoverflow.com

Why is Rails UJS ajax:success bind being called twice?

独自空忆成欢 提交于 2019-11-30 05:44:54
问题 I have a simple form: = form_for(posts_path, :id => "new_post", :remote => true) do = text_field_tag "post[input]" = submit_tag "Post!" I have bound a callback to the ajax:success event: $("form#new_post").bind("ajax:success", function(xhr, data, status){ alert("Post Created!"); }); When I click the Post! button, the Post Created comes up twice . Why? I'm using Rails 3.1 which by default is using jquery-ujs. 回答1: That is because your page is loading jquery_ujs code twice in development mode

carrierwave - rails 3.1- undefined method: image_will_change

♀尐吖头ヾ 提交于 2019-11-30 05:42:15
I get an error that look like this: undefined method `post_image_will_change!' for #<Post:0xf4e9184> app/controllers/posts_controller.rb:43:in `new' app/controllers/posts_controller.rb:43:in `create' I've included this in my "post" model: attr_accessible :title, :name, :content, :post_image mount_uploader :post_image, PostImageUploader and in _form.html.erb I've added: :html => { :multipart => true } I looked CarrierWave Error but that doesn't help me. Any clues of what generates that error? I've migrated the database and so forth (followed the railscasts guide on carrierwave exactly..) The OP