UnKnown Error
mbdev
ruby-on-rails asset-pipeline scss 2014-1-12 12:38:40
I am developing a rails application that gets quite big and compiling the whole scss after every change takes longer than I want. I thought if there was a way to dynamically compile scss file just for the portion of the site I am building that will be much faster. And I can get the compiled result as string and output to the head.Is there a way to do it? Such as:<head><style type=”text/css”><%= compile_scss(‘new_page.scss’) %></style> </head>
user206481
ruby-on-rails actionmailer 2014-1-12 9:23:54
Is it possible to set template_root for ActionMailer at runtime? I seem to be able to do this in development mode by using:ActionMailer::Base.template_root = my_view_path if File.exists (File.join(my_view_path,”test_mailer”))I’m checking to see if the mailer views directory exists in my special view_path, and using that view_path for ActionMailer if it exists. Otherwise leave it default. This is happening at request time, not at config time in environment.rb. Works in development mode.When I
Boris Barroso
javascript ruby-on-rails node.js asset-pipeline 2014-1-12 7:19:30
I have installed nodejs on ubuntu 12.04 server and I want to know why I have problems when compiling assets, when I go to the console rails c I run thisExecJS::Runtimes.best_available=> #<ExecJS::ExternalRuntime:0x0000000118cc88 @binary=”nodejs”, @command=[“nodejs”, “node”], @deprecated=false, @encoding=”UTF-8″, @name=”Node.js (V8)”, @runner_path= “/home/bonsai/.rvm/gems/[email protected]/gems/execjs-1.4.0/lib/execjs/support/node_runner.js”,@test_args=nil,@test_match=nil>And of cour
wahwahsoserious
ruby-on-rails git github 2014-1-12 4:01:35
I would like to make a simple document editor using a rails app but I want it to have version history. The best way I can see to do this would be to use git, but I can’t find any information about using Git inside of a rails app! When I search for git/rails (or any combination), I receive an overload of information about committing your projects, installing git and using it as a developer. What I am trying to find, is how to use it INSIDE of the rails app, so the user using the webpage can ed
Gavin Miller
ruby-on-rails performance activerecord heroku ruby-on-rails-4 2014-1-12 1:55:09
I’m trying to diagnose a performance issue in Rails 4 and can’t figure out what’s going on. Here’s the timing that I’m seeing on my server:Completed 200 OK in 2816ms (Views: 644.1ms | ActiveRecord: 162.0ms | Solr: 0.0ms)I’m (mostly) satisfied with my Views time, and ActiveRecord time, but don’t understand why the Completed time (2816ms) is so large.What does that time represent? And is there any way to decrease that time?
Fabian
ruby-on-rails 2014-1-12 0:40:51
I would like to send a small amount of email from my app through Gmail. Now, the SMTP settings will be determined at runtime (ie: from the db), can this be done? — edit —I can set the ActionMailer subclass (named Notifier) smtp settings in one of the class’ methods. This way I can set the username and password for sending the email dynamically. The only thing is that you have to set ALL the smtp_settings. Is it possible to set just the username & password settings in the class method?Th
Blue Smith
ruby-on-rails memcached dalli 2014-1-11 23:38:13
My application has a feature that allows the administrator can change the cache_store configuration via a GUI. Then the new configuration will take effect right away.The default cache_store in my production.rb:config.cache_store = :memory_storeThe admin can optionally change to use memcached with Dalli store. I tried to change Rails.application.config.cache_store:Rails.application.config.cache_store = :dalli_store, ‘localhost:11211’, ‘localhost:11212’But the Rails.cache does not change:Rails.cac
Topher Fangio
ruby-on-rails sproutcore scss 2014-1-11 20:11:53
I have a project whose front-end is written in Sproutcore (1.6) and whose back-end is written in Ruby on Rails.I’ve been using SCSS in the Sproutcore project and I now need to allow the client to change their colors on the fly. It doesn’t have to be instantaneous, but they should be able to select their color, hit save and re-render the page with the new colors. The problem is, Sproutcore compiles the SCSS at build-time meaning I have no control over it once it’s built and released.As far as I’v
prusswan
javascript ruby-on-rails 2014-1-11 19:10:17
Are there any known performance differences between the various javascript runtimes available for Rails, like therubyracer (probably not the fastest), v8, node.js etc, and if so, which can be considered as among the fastest of the lot?Edit: Also, for most practical intents and purposes, how many real options are there actually? On further reading it seems that everything points back to v8..
latortuga
ruby-on-rails ruby cryptography arguments 2014-1-11 17:50:36
I’m looking for a way to supply an argument to a ruby on rails project at runtime. Essentially, our project uses public key cryptography to encrypt some sensitive client data and we want the ability to supply the password to the private key file at runtime.
Michael Durrant
javascript ruby-on-rails ruby-on-rails-3 node.js ruby-on-rails-3.1 2014-1-11 15:48:52
I created a new Rails project using rails 3.1.0.rc4 on my local machine but when I try to start the server I get: Could not find a JavaScript runtime. See here for a list of available runtimes. (ExecJS::RuntimeUnavailable)Note: This is not about Heroku.
andresbravog
ruby-on-rails ruby-on-rails-3 heroku asset-pipeline 2014-1-11 12:59:34
I’m triying to deploy my rails 3.2.8 app to heroku and i’m getting this error all the time:2012-11-22T13:26:30+00:00 app[web.1]: Exiting 2012-11-22T13:26:30+00:00 app[web.1]: => Booting WEBrick 2012-11-22T13:26:30+00:00 app[web.1]: => Call with -d to detach 2012-11-22T13:26:30+00:00 app[web.1]: => Rails 3.2.8 application starting in production on http://0.0.0.0:24003 2012-11-22T13:26:31+00:00 heroku[web.1]: Process exited with status 1 2012-11-22T13:26:31+00:00 heroku[web.1]: State chan
tomciopp
ruby ruby-on-rails-3 css-selectors nokogiri web-scraping 2014-1-11 11:15:51
I am using nokogiri to scrape a website and am running into an issue when I try to grab a field from a table. Note: I am using selector gadget to find the css selector of the table. I am grabbing data from a government website that details information on motor carriers. here is an example page The method that I am using looks like the followingdef scrape_databaseurl = “http://safer.fmcsa.dot.gov/query.asp?searchtype=ANY&query_type=queryCarrierSnapshot&query_param=USDOT&query_string=#
rcrogers
ruby-on-rails-3 module scope constants 2014-1-11 9:57:25
In my Rails 3.2 models directory, I have a folder “foo” containing two classes:# foo/bar.rb class Foo::Bar; end# foo/baz.rb class Foo::Bazdef self.testputs Bar.to_send endNote that Foo::Baz.test references Foo::Bar as simply Bar, since Bar and Baz are in the same module.I then open the console and call Foo::Baz.test twice:1.9.3-p0 :001 > Foo::Baz.test Foo::Bar=> nil 1.9.3-p0 :002 > Foo::Baz.test NameError: uninitialized constant Foo::Baz::Barfrom /../app/models/foo/baz.rb:2:in `test’As
mayatron
ruby-on-rails ajax ruby-on-rails-3 jquery-ajax canvas 2014-1-11 8:19:49
I’m trying to use send_data to return a PNG image as the response for a ajax post request. How do I get the browser to trigger a download on the success callback?DetailsI’m generating a large base64 image using canvas.toDataURL(), and then posting it to Rails (v3.2.6). Rails decodes it to a binary PNG, and sends the image back to the client. I’ve also tried send_file but it has the same issue. Other optionsDownload image client side: We can’t do this because (1) Safari crashes on large base64 UR
aguazales
ruby-on-rails windows ruby-on-rails-3 apache deployment 2014-1-11 3:49:37
Is there any good way at all to deploy a Ruby on Rails app built on Ruby 1.9.3 and Rails 3.2.6 with Apache on a Windows machine? I’ve spent hours scouring the forums, but all of the posts seem to be too old to work with the newest versions of Ruby and Rails. Mongrel is no longer under development and constantly causes Rails to crash, thin has only rudimentary Windows support and on my computer causes the Ruby runtime to “terminate itself in an unusual way”, Passenger is Linux-only… I’m kinda l
dimitko
ruby-on-rails-3 activeadmin 2014-1-11 0:50:32
I am having these objects:class District < ActiveRecord::Basebelongs_to :city end class City < ActiveRecord::Basehas_many :districts endWhat I would like to do (and been unable to do so thus far), is: have a City column in District’s index and that column should be sortable on City.name.Closest thing I was able to do without crashing ActiveAdmin is:index docolumn City.human_name(:count => :other), :city, :sortable => :city_id endWhich of course is not good enough; I don’t want to sor
Jon Seigel
rubygems ruby-on-rails-3 gem bundler 2014-1-11 0:20:39
i am getting a strange bundler error when runningbundle packwith bundler 0.9.12 any ideas? (see pastie for a better formatted code: http://pastie.org/881328 )/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:49:in `initialize’: not in gzip format (Zlib::GzipFile::Error)from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:49:in `new’from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_inpu
sscirrus
ruby-on-rails ruby-on-rails-3 heroku 2014-1-10 23:45:52
I have been hosting a site on Heroku for a few months that is very soon to go into production.Since I began with them, there have been at least three significant outages, one of which was the disastrous Amazon outage last month and another of which is a multi-hour outage happening today.I believe in Heroku’s vision and I think they are a great company, but I am faced with the ultimate problem: if they can’t keep sites up and running, everything I like about them doesn’t really matter.Is Heroku a
finpingvin
sql ruby-on-rails ruby ruby-on-rails-3 arel 2014-1-10 23:26:09
I have trouble with using Arel to aggregate 2 columns in the same query. When I run this, the whole server freezes for a minute, before the rails dev-server crashes. I suspect an infinite loop :). Maybe I have misunderstood the whole concept of Arel, and I would be grateful if anybody could have a look at it.The expected result of this query is something like this: [{:user_id => 1, :sum_account_charges => 300, :sum_paid_debts => 1000},…]a_account_charges = Table(:account_charges) a_paid_debts
Pratik Khadloya
ruby-on-rails ruby-on-rails-3 meta-search 2013-9-28 5:15:59
I am in the process of upgrading my app from Rails2 to Rails3. My Rails2 app uses searchlogic heavily. After googling i’ve come to know that searchlogic is not compatible with Rails3 and need to use meta_search instead. But i havent quite understood the usage of meta_search vis-a-vis searchlogic. If i have a User model with :name and :address fields, i am not able to use the following methods with meta_search. What am i doing wrong? ruby-1.9.2-p0 > User.name_null NoMethodError: undefined
Jords
ruby-on-rails meta-search tire 2013-9-19 14:05:32
I’m using active_admin and that’s bringing in meta_search to my project. (Which I don’t want to use for anything else).It seems to be defining the search method on all my models, which then means when I include tire, I can’t use it’s search method.There seems to be something strange with how it’s defining the method also – method_defined? says that the search method is not defined, yet when I call it I get the meta_search one. Even if I define my own search method in the class, when I call Docum
RainChen
ruby mongoid meta-search 2013-9-7 14:07:03
I tried meta_search, but after adding “include MetaSearch::Searches::ActiveRecord” into my model, it raised an error as “undefined method `joins_values'” when run “MyModel.search(params[:search])”I think I dont need full text, so I think following gems are not suitable for my project now:: mongoid_fulltext mongoid-sphinx sunspot_mongoid mongoid_searchI tried a old gem named scoped-search I can make it work for example:get :search do@search = Notification.scoped_search(params[:search]searc
Brian W
ruby-on-rails ruby activeadmin meta-search 2013-9-5 19:52:10
I’m trying to simply allow filtering of categories on the Locations page for ActiveAdmin.I have three models:class Location < ActiveRecord::Basehas_many :categories_locationshas_many :categories, :through => :categories_locationsclass CategoriesLocation < ActiveRecord::Basebelongs_to :categorybelongs_to :location endclass Category < ActiveRecord::Basehas_many :categories_locationshas_many :locations, :through => :categories_locations endOn my locations page, I’m using this filter:
jeremiahishere
kaminari meta-search 2013-9-1 22:47:18
I am using Kaminari for pagination and trying to use meta_search for column ordering. I would like my code to look like this:@search = Organization.search(params[:search]) @organizations = @search.page(params[:page])When I write it this way, I am getting the error, undefined method `page’ for #<MetaSearch::Builder:0x7fadb8958630>The solution I have found is this:@search = Organization.search(params[:search]) @organizations = Kaminari.paginate_array(@search.all).page(params[:page]It works
jklina
ruby-on-rails ruby-on-rails-3 meta-search scopes 2013-8-29 5:25:51
In my Widget model I have the following:scope :accessible_to, lambda { |user|if user.has_role?(‘admin’)self.allelseroles = user.rolesrole_ids = []roles.each { |r| role_ids << r.id }self.joins(:widget_assignments).where(‘widget_assignments.role_id’ => role_ids)end }Ideally, I would like to use this scope as a filter for Ransack’s search results, so in my controller I have:def index@q = Widget.accessible_to(current_user).search(params[:q])@widgets = @q.result.order(‘created_at DESC’) endD
ere
ruby-on-rails ruby-on-rails-3 meta-search texticle 2013-8-24 18:47:05
I use the active_admin gem which requires the meta_search gem and noticed it conflicts with texticle as they both use the search method and it breaks as a result. I read in a few places about similar problems involving solr where they were able to user an alternative method solr_search but I found no such luck using texticle.NoMethodError (undefined method `relation’ for []:ActiveRecord::Relation):Any ideas how I can avoid this?
Geoffrey Hug
ruby-on-rails ruby-on-rails-3 pagination meta-search 2013-8-23 19:12:28
I’m trying to paginate my search results from metasearch but I get a undefined method `paginate’ for #<ActiveRecord::Relation:0x6d3df28>This is the code in my controller :@search = Camping.search(params[:search])if !params[:search].nil?@campings = @search.paginate(:page => params[:page]) else@campings = []; endThis should be so simple I really don’t see what’s wrong…I have those in my gem file :gem ‘will_paginate’, ‘3.0.3’ gem ‘bootstrap-will_paginate’, ‘0.0.6’
Yasser
ruby-on-rails-3 activeadmin formtastic meta-search 2013-8-17 23:54:17
I’ve a table with an integer column called “map_id”, I want to add an activeadmin filter to filter if this column IS NULL or IS NOT NULL.How could this be implemented ?I tried the following filterfilter :map_id, :label => ‘Assigned’, :as => :select, :collection => {:true => nil, :false => ”}But, I get the following error message :undefined method `map_eq’ for #
Rafael Oliveira
ruby-on-rails ruby-on-rails-3 meta-search 2013-8-8 13:08:00
I’m using fantastic MetaSearch by Ernie, but I’m having an annoying issue.In my application.html.erb I have an search field, just like this one on top of StackOverflow page.<%= form_for @search, :url => vagas_path do |f| %><%= f.text_field :titulo_or_empresa_user_username_contains %><%= f.submit “”, :class => “search-button”, :name => “submit” %> <% end %>The problem is that I don’t have @search initialized in all actions of all controllers, so when I’m not at Va
Prince John Wesley
ruby-on-rails-3 ruby-on-rails-3.1 scopes 2013-10-12 1:11:58
I stumbled upon a wonderful article about scopes on Rails 3+ : http://edgerails.info/articles/what-s-new-in-edge-rails/2010/02/23/the-skinny-on-scopes-formerly-named-scope/index.htmlYou can read there (in ‘Crazy Town’ section) that it’s possible to merge scopes from different models like this :class User < ActiveRecord::Basescope :published, lambda {joins(:posts).group(“users.id”) & Post.published} endwhich works just as expected, and allows you to do :User.published.to_sql #=> SELECT
Brendon Muir
ruby-on-rails-2 scopes 2013-10-11 17:47:50
I’m upgrading from Rails 2.3.5 to 2.3.17 and have come across a pretty obscure problem. I use the following extensions to inject a scope within an association accessor, and provider a custom builder:module XYZFilterExtensiondef in_context(context)if proxy_owner.context == :abc && context != :adminscoped(:conditions => {:startup => false})elsescoped({})endendendmodule OtherExtensiondef build_with_component_instance(attributes = nil)attributes ||= {}attributes.reverse_merge!(:parent_
jklina
ruby-on-rails ruby-on-rails-3 meta-search scopes 2013-8-29 5:25:51
In my Widget model I have the following:scope :accessible_to, lambda { |user|if user.has_role?(‘admin’)self.allelseroles = user.rolesrole_ids = []roles.each { |r| role_ids << r.id }self.joins(:widget_assignments).where(‘widget_assignments.role_id’ => role_ids)end }Ideally, I would like to use this scope as a filter for Ransack’s search results, so in my controller I have:def index@q = Widget.accessible_to(current_user).search(params[:q])@widgets = @q.result.order(‘created_at DESC’) endD
Stu
yii relation scopes default-scope 2013-6-24 18:03:47
I can’t find too much documentation on applying a default scope to a model in yii, I was wondering if someone could explain or point me in the right direction.The quick version of my question:Is it possible to add a relation to a default scope, or to add a ‘with’ criteria by default to every AR search on a model?The long version of my question:A quick summary of my app:I have two models, provider and item. Which have a m:1 relationship where a provider can have many item’s, but each item can onl