awesome_nested_set
I have a select input: f.select :category_id, nested_set_options(Category, @categories) {|i| "#{'-' * i.level} #{i.name}" } What is the most efficient way to show only the categories with level > 1 ? ...
I have a select input: f.select :category_id, nested_set_options(Category, @categories) {|i| "#{'-' * i.level} #{i.name}" } What is the most efficient way to show only the categories with level > 1 ? ...
Hi, Does anybody know some nice documentation about the ruby "handsoap" gem to get me started? Thanks ...
I have a new gem I'm playing with, but I'm not sure where to put it so that it is initialized, but that I don't have to do it each and every time I use my method which uses it. def self.get_rate(from, to, amount) Money.default_bank.fetch_rates #<---------------- Here it is... if to == "USD" or from == "USD" rate = Mon...
Does anyone have an example of how to add additional headers to the Thin Ruby server? Specifically, I need to add either "Accept-Ranges" or "X-Content-Duration" for media based files served, ogg audio and video mostly, served via the new HTML5 media elements. If someone has a fix for this, or a link to a really good tutorial about Rack,...
I've got a rails app using the master_slave_adapter plugin (http://github.com/mauricio/master_slave_adapter/tree/master) to send all selects to a slave, and all other statements to the master. Replication is setup using Mysql master / slave. I'm trying to validate that all the SQL statements are indeed going to the right place. Select...
MySQL allows the value of "0000-00-00" for date fields, however ActiveRecords treats an assignment to a Date value with that string as being nil. I have a legacy application that relies on that exact field content for the notion of "Never", so if the customer last payment date is "0000-00-00" it acknowledges as being "Never" paid. Is t...
When routing resources in Rails the optional format attribute is automatically appended to the generated routes. This is so that the resource in question can be requested as either XML, HTML etc. Which formats that is actually allowed is usually described in the controller using respond_to. But in many cases you only want to support HTM...
I have been practicing TDD in C# for several years now and recently have moved to Ruby on Rails full time. I am continuing the practice of TDD with RSpec. My question is regarding the process of finding references while refactoring. In Visual Studio I was addicted to Resharper's "find all references" when renaming or replacing methods. ...
Hi, how can I make ruby on rails app start automatically on Mac OS X Server boot? Thanks. ...
I'm trying to figure out how to use RJS to swap between two fields... i know how to replace the values but I can't seem to figure out how to read it. Is it not possible to read values thru RJS? Only to replace? <%= link_to_function "Swap" do |page| #to_value = page[:currency_to].value page[:currency_from].value = to_value...
I'm looking for a desktop application framework similar to Rails: Good ORM MVC Default directory structure View Helpers/DSL Elegant Open Source Fun language Decently mature ...
Apparently, after upgrading to Rails 2.3 my session storage has stopped working. I used to have this: session :session_expires => 3.years.from_now in my application_controller.rb, but now every time i close the browser (chrome) the session expires. I read from somewhere that session_expires would have changed to expire_after, but sess...
Hi All, We have a very lage Rails app that has two distinct sections: the front end and the CMS/Admin. We would like to break up the app into two pieces (for maintenance, as we have distinct teams that work on the front end vs. back end and they could have different release cycles). One thought was to start a new Admin 2.0 app that has...
We have a team of developers who are each going to be developing database migrations for our system using the Rails tools. Migrations seems at first like a great way to manage changes to the database schema, but as we go on it has become harder to manage changes in a distributed way. If we each develop migrations on our own, how can we r...
I've got an atom feed in my application that's build using atom_feed, and it's working, except that when the feed is subscribed to in Google Reader, the link it uses for the title of the subscription is pointing to the wrong URL. I tried specifying the root_url parameter as such: atom_feed(:root_url => 'http://link.to/proper.page') do ...
I'm trying to use delayed_job for various parts of a rails app. The problem is that if we have multiple instances of the app running, but certain jobs (processing uploads, for example) need to be run by local workers, whereas others could benefit by being run by any worker. Does anyone have any recommendations for a good approach to hav...
I'm getting the following error while running my Rails website and I believe it is causing it to go down. I'm using Passenger and my site is heavily trafficked. When I try to bring it back online, Apache spawns a large number of children and the load on the machine spikes to about 50, and the site becomes extremely slow. I have no shor...
Is it possible to include view code in a plugin, such that an app using the plugin can simply call reference the view code like it might reference one of its own partials. Am I off track here or are there good examples of plugins which do this.. ...
Does anyone know a way to determine if a Rails association has been eager loaded? My situation: I have a result set where sometimes one of the associations is eager loaded, and sometimes it isn't. If it isn't eager-loaded, then I want to look up associations using ActiveRecord's find. If it is eager loaded, I want to use detect. ...
I have this command in a Rails controller open(source) { |s| content = s.read } rss = RSS::Parser.parse(content, false) and it is resulting in temporary files that are filling up the (scarce) disk space. I have examined the problem to some extent and it turns out somewhere in the stack this happens: io = Tempfile.new('open-uri')...