rails-3.1

Upgrade from rails 3.1.3 to rails 3.2.1. Error with assets

馋奶兔 提交于 2021-01-27 04:09:08
问题 I try to upgrade my application from rails 3.1.3 to rails 3.2.1 and I have a problem with assets. I have this kind of error : ActionController::RoutingError (No route matches [GET] "/assets/logos/opera_logo.png"): actionpack (3.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call' actionpack (3.2.1) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call' railties (3.2.1) lib/rails/rack/logger.rb:26:in `call_app' railties (3.2.1) lib/rails/rack/logger.rb:16:in `call'

heroku run console returns 'Error connecting to process'

跟風遠走 提交于 2019-12-17 22:32:20
问题 I have deployed a rails 3.1 app to Heroku Cedar stack, and am trying to perform a: heroku run rake db:migrate it returns: Running console attached to terminal... Error connecting to process I also try to simply launch the console: heroku run console Any run command returns the same error. Running console attached to terminal... Error connecting to process Looking at the logs I get the error code: 2011-09-25T16:04:52+00:00 app[run.2]: Error R13 (Attach error) -> Failed to attach to process

Rails 3.1.3 using anchor attribute with link_to tag from posts/index to posts/show/id not working

心已入冬 提交于 2019-12-12 08:48:45
问题 I am using a link_to tag on my posts/index view and want to link it to my posts/show/id view with an anchor that makes it scroll down to the comments form. For some reason I can't get the anchor to work. Here is my code: In posts/index <%= link_to 'Add a Comment', post, :anchor => 'comment_form' %> This fails to append the # sign to the end of the link, so it is just localhost:3000/posts/id. I have also tried many variations for link_to, including: <%= link_to 'Add a Comment', post(:anchor =>

Capistrano for Rails 3.1

岁酱吖の 提交于 2019-12-07 00:45:38
问题 I am using Rails 3.1 and Capistrano, I get No such file or directory errors for /public/images, /public/stylesheets, and public/javascripts errors. Searching the Internet, I found a number of blog posts suggesting set :normalize_asset_timestamps, false which removed these problems. However, I am not sure if I am doing the right thing since precompile still fails and I am new to Rails 3.1. rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile still fails on the production server. I

How can I display entries in a horizontal table in rails 3.1

我的未来我决定 提交于 2019-12-06 09:35:53
问题 I would like to display items for an e-commerce page in Rails, and instead of a standard vertical list table, I would like to the title and images from left to right, about 4 across, then continue the list on as added: ie. Entry 1 Entry 2 Entry 3 Entry 4 Entry 5 Entry 6 .... My first guess is to make a scope for each column- where I could skip entries by a factor of 4, but I would like to know if there is a better solution using CSS or any other trick? 回答1: There's a method on Enumerable

Capistrano for Rails 3.1

无人久伴 提交于 2019-12-05 06:50:58
I am using Rails 3.1 and Capistrano, I get No such file or directory errors for /public/images, /public/stylesheets, and public/javascripts errors. Searching the Internet, I found a number of blog posts suggesting set :normalize_asset_timestamps, false which removed these problems. However, I am not sure if I am doing the right thing since precompile still fails and I am new to Rails 3.1. rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile still fails on the production server. I set load 'deploy/assets' set :rake, "bundle exec rake" in deploy.rb but it doesn't help. Still cap

How do I display the user's location with a marker in gmaps4rails?

て烟熏妆下的殇ゞ 提交于 2019-11-29 10:27:19
问题 I have been trying to get a custom use of gmaps4rails running, and I have the code set to display my string of json coordinates on the map, and the center on user IS working, I can zoom into my location from home, work and my phone. I just cannot get the js right to display an 'Im here' button on the map once permission is given. here is the code I use for the map from gmaps4rails: <%= gmaps(:map_options => {:detect_location => true, :center_on_user => true, :auto_zoom => false, :zoom => 12,

URL of images in JavaScript code using Rails 3.1 asset pipeline?

本秂侑毒 提交于 2019-11-28 21:11:18
In CSS files, you can get the proper name of an image asset (with the fingerprint) by using: background-image: url(image-url("rails.png")) but how do you do the same from a JavaScript file? Richard Hulse I see you are using the sass helper method. In standard (non Sass) CSS you do something like this: .class { background-image: url(<%= asset_path 'image.png' %>) } The CSS file will need to have erb added to the extensions: file_name.css.erb For javascript the same rules apply: file_name.js.erb and in the file: var image_path = '<%= asset_path 'image.png' %>' The Rails asset pipeline guide is

URL of images in JavaScript code using Rails 3.1 asset pipeline?

我与影子孤独终老i 提交于 2019-11-27 20:53:00
问题 In CSS files, you can get the proper name of an image asset (with the fingerprint) by using: background-image: url(image-url("rails.png")) but how do you do the same from a JavaScript file? 回答1: I see you are using the sass helper method. In standard (non Sass) CSS you do something like this: .class { background-image: url(<%= asset_path 'image.png' %>) } The CSS file will need to have erb added to the extensions: file_name.css.erb For javascript the same rules apply: file_name.js.erb and in