ruby-on-rails-3.2

How to use SASS, HAML, and CoffeeScript in Rails 3.2.x Engine?

此生再无相见时 提交于 2019-12-24 09:57:33
问题 Currently, I have a Rails 3.2.9 Engine which is using sass-rails . When I generate a controller with a couple actions, the assets are also generated (i.e., javascript and CSS). However, both the Javascript and SASS are *.js and *.css files. They're not CoffeeScript ( *.js.coffee ) or SASS ( *.css.sass ). Any ideas how to get this work? 回答1: Here's a different solution which will use the coffee-rails and sass-rails gems by default - also fixes haml-rails . I added this to the top of my engine

Rails: cannot load such file — safe_yaml/transform/to_symbol (LoadError)

穿精又带淫゛_ 提交于 2019-12-24 09:36:19
问题 My rails app is not running and i am getting error: cannot load such file -- safe_yaml/transform/to_symbol (LoadError) I dont know why this error is coming. When i remove gem 'safe_yaml', it gives error: Could not find safe_yaml-0.9.4 in any of the sources (Bundler::GemNotFound) When i install gem safe_yaml-0.9.4, it gives: cannot load such file -- safe_yaml/transform/to_symbol (LoadError) Can anybody tell how to solve this? Thanks 回答1: There was problem with safe_yaml version. I have rails

Rails controller path not found

那年仲夏 提交于 2019-12-24 08:20:55
问题 My form tag in my view: <%= form_tag view_all_rater_path, :method => 'get' do %> <p> <%= text_field_tag :search, params[:search], :placeholder => 'Search by Set # or date' %></br> <%= submit_tag "Search", :class => "btn btn-link", :name => nil %> </p> <% end %> My controller action: def view_all if params[:search] @ratings = RatingSet.find(:all, :conditions => ['id = ? or rating_date like ?', "%#{params[:search]}%"]) else @ratings = RatingSet.all end end My routes: resources :rater, :only =>

Why is Highchart loaded twice in my rails app ? (Uncaught Highcharts error #16)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 07:24:06
问题 I can't make working the basic example of Highcharts. I got these errors : Uncaught Highcharts error #16 in app/assets/javascripts/application.js Uncaught TypeError: undefined is not a function in app/assets/javascripts/graphique_repartition_budgetaire Highcharts says that the error 16 is because : This error happens the second time Highcharts or Highstock is loaded in the same page, so the Highcharts namespace is already defined. Keep in mind that the Highcharts.Chart constructor and all

paperclip Error while determining content type: Cocaine::CommandNotFoundError in Rails 3.2.1

给你一囗甜甜゛ 提交于 2019-12-24 07:23:29
问题 I tried to use the code given here to upload and crop images using Paperclip.I am able to upload image and also the image is cropped but without selection area. The console gives the following error : [paperclip] Error while determining content type: Cocaine::CommandNotFoundError I have tried solutions given on other articles of SO like this and this, but none of them solved this problem. Any other suggestions are most welcomed. NOTE : I am working on Windows 7. Gems installed are : gem

failed to allocate memory on the console and internal server error on the browser

不问归期 提交于 2019-12-24 07:09:42
问题 I have this error while loading the data from files in to database. Please help me out in getting this right. here is the method : clusters.each do |cluster| cluster_path = cluster.path root = current_root + cluster.name+'/' Log.info "<br/> --------- Starting data popuation for #{cluster_path} ---------------" population_time[:bp_data] = populate_bp_data(root+fileName[:bp_data], cluster_path, @dataset.id) population_time[:m_lint] = populate_m_lint(root+fileName[:m_lint], cluster_path,

Using Closure_tree gem instead of Awesome nested set

给你一囗甜甜゛ 提交于 2019-12-24 06:35:30
问题 Hi I followed the link to set up closure_tag gem. When i tried to use closure_tree syntax in the following way (newStructure.find_or_create_by_path(parent) instead of newStructure.move_to_child_of(parent)) ... got the following error : "Can't mass-assign protected attributes: ancestor, descendant, generations" is this the correct way of using newStructure.find_or_create_by_path(parent) ? def self.import(path) newStructure = FileOrFolder.find(:first, :conditions=>["fullpath = ?", path]) if

Rails 3.2 Engines - routes not working in test cases

我的未来我决定 提交于 2019-12-24 06:00:57
问题 I mounted in my app the RailsAdmin engine ( according to the instructions from the wiki ) using mount RailsAdmin::Engine => '/backend', :as => 'rails_admin' I had to extend one controller from the engine to add a before_filter. When running my app in development, my extension and the other engine features are working perfectly. However I have an issue in writing functional tests using Test::Unit for my before_filter. The filter kicks in at the right moment and works as expected, but once the

Rails - Strategies for avoiding OmniAuth and sharing computer risks

半城伤御伤魂 提交于 2019-12-24 05:06:08
问题 While testing Omniauth and following the popular Ryan Bates' videos, I thought that there is a major security hole. Here is an example I have two users: Aurelien and John John in the morning logs in onto twitter but forgets to log out. Then he goes on myapplication and connects to the Twitter service through the http://myapplication.com/auth/twitter. He is automatically assigned to a Twitter Authentication, because Twitter remembers that John was logged in. John goes to work. Meanwhile his

Using Rails Inflections with `rails generate`

蓝咒 提交于 2019-12-24 03:56:30
问题 I'm trying to generate a model called ClassAttendance , but Rails keeps naming the migrations class_attendances . I've tried correcting this problem by placing the following code the following code in \config\initializers\inflections.rb : ActiveSupport::Inflector.inflections do |inflect| inflect.uncountable "attendance" end This seems to work fine in the rails console: $ rails console Loading development environment (Rails 3.2.6) irb(main):001:0> "attendance".pluralize => "attendance"