ruby-on-rails-3.2

error precompiling assets when moving to production

▼魔方 西西 提交于 2019-12-09 14:03:50
问题 I am trying to move my project to production, trying to RAILS_ENV=production bundle exec rake assets:precompile gives me an error, without specifying in which file it is. rake aborted! Sass::SyntaxError: Invalid CSS after "}": expected selector or at-rule, was "}" (sass):89 /Users/mac/.rvm/gems/ruby-2.2.3/gems/sass-3.4.23/lib/sass/scss/parser.rb:1207:in `expected' /Users/mac/.rvm/gems/ruby-2.2.3/gems/sass-3.4.23/lib/sass/scss/parser.rb:1137:in `expected' /Users/mac/.rvm/gems/ruby-2.2.3/gems

Paperclip Errno::EACCES (Permission denied - /system)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-09 11:03:15
问题 My production environment is : ruby 1.9.2-p320 , rails 3.2.7, paperclip 3.1.4, mysql, Ubuntu 8.10 x86 64bit. I have a Errno:EACCES Permission denied /system error when i try to upload a file with paperclip. Useless to say that locally this doesn't happen. I checked the public directory permissions and it's 775, the public/system permission is 777 as well as all it's inner directory. The tmp directory permission is : 775 too. Moreover the user used to deploy the application is www-data:root

rake db:migrate error (Function 'inotify_init' not found)

♀尐吖头ヾ 提交于 2019-12-09 07:13:24
问题 I just got done setting up my rails environment on my old mac book and ran into this error. I've installed FFI and rb-inotify. I've also ran bundle install again. I've looked at https://github.com/ffi/ffi/issues/66 and https://groups.google.com/forum/?fromgroups=#!topic/ruby-ffi/gj3_k34o80k which both indicate that this is a linux specific API. There is a suggestion on the second of those links that says I should just remove that gem and things that depend on it, but I am hesitant to remove

How can I run SOME initializers when doing a Rails assets:precompile?

给你一囗甜甜゛ 提交于 2019-12-09 04:21:40
问题 Background I have an app that I recently updated to Rails 3.2.1 (from Rails 3.0.x) and have refactored the JS and CSS assets to make use of the new asset pipeline. The app is hosted on Heroku with the Celadon Cedar stack. App Config I keep application specific configuration in a YAML file called app_config.yml and load it into a global APP_CONFIG variable using an initializer: # config/initializers/load_app_config.rb app_config_contents = YAML.load_file("#{Rails.root.to_s}/config/app_config

Routing errors when upgrading from rails 3.1 to rails 3.2 due to underscores in module namespaces

心已入冬 提交于 2019-12-09 03:44:33
问题 We have a rails application and we have a API namespace defined as Api::V1, Api::V1_2, Api::V1_3 etc. In routes.rb, we have set the following namespace :api do ["v1", "v1.2", "v1.3", "latest"].each do |name| namespace name, {:module => name.gsub(".","__"), :as => name.gsub(".","_") } do constraints :format => /json/ do # user scoped views resources :some_endpoint, :only => [:create, :index, :show, :update, :delete], :path => "scheduler" do member do put 'edit' post 'duplicate' end end end end

Rails HABTM with checkboxes

。_饼干妹妹 提交于 2019-12-09 03:21:30
问题 I have three tables, accounts, campaigns and accounts_campaigns. I want to have checkboxes for select accounts in the campaigns edit form. I have Campaign's model like this: class Campaign < ActiveRecord::Base has_and_belongs_to_many :accounts accepts_nested_attributes_for :accounts end I think i dont need to define the relationship on Account. And my form is: = hidden_field_tag "campaign[accounts_ids][]", nil - Account.all.each do |account| %label.checkbox = check_box_tag "campaign[accounts

Devise Omniauth undefined method omniauth_authorize_path

巧了我就是萌 提交于 2019-12-08 16:18:07
问题 I've noticed that when logging to Devise I have started to receive these error message. I'm using Devise 2.2.4 with Omniauth 1.1.4 and Omniauth-Facebook 1.4.1 Does anybody know what is the cause of this error? ActionView::Template::Error (undefined method `omniauth_authorize_path' for #<#<Class:0xb85e534>:0xb904e5c>): 21: <%- if devise_mapping.omniauthable? %> 22: <%- resource_class.omniauth_providers.each do |provider| %> 23: <% logger.info "hey #{provider} , dolphin and #{resource_name}" %>

How to update multiple columns in Ruby on Rails 3?

笑着哭i 提交于 2019-12-08 14:55:58
问题 Just out of curiosity, is there a way to say this... user.update_column(:field1, true) user.update_column(:field2, true) ... in one line in Ruby on Rails? As far as I know an update_columns method does not exist... 回答1: You can use update_all as follows: User.where(:id => user.id).update_all({:field1 => true, :field2 => true}) This will generate the following update statement (mysql): UPDATE users SET field1 = 1, field2 = 1 WHERE users.id = <whatever> Callbacks and validations will not be run

Writing a matrix to a text file

[亡魂溺海] 提交于 2019-12-08 14:09:13
问题 So i have done how to read a matrix from a text file where the first line defines the elements, however my question is how would i do the opposite that would write to the text file. I would like it to ask the user for the row 0 column 0, and add on, and have this code to write into the console, but do not know how to do into a text file This is the code to write into console: Dim size As Integer = 3 Dim numberWidth As Integer = 2 Dim format As String = "D" & numberWidth Dim A(size - 1, size -

ArgumentError (A secret is required to generate an integrity hash for cookie session data

雨燕双飞 提交于 2019-12-08 13:56:08
问题 I am getting this error while running rails application and here is the complete Error ArgumentError (A secret is required to generate an integrity hash for cookie session data. Use config.secret_token = "some secret phrase of at least 30 characters"in config/initializers/secret_token.rb): ** I use rvm 1.9.3 and rails 3.2.13. Any help appreciated. Thanks in advance. 回答1: The message is pretty straight forward. Check in the config/initializers/secret_token.rb file for the config.secret_token