Memcached rails api - multi set support
Is there a way to set multiple keys of a Memcached instance in one call in Rails? i.e. cache.set_multi("k1" => "v1", "k2" => "v2") ...
Is there a way to set multiple keys of a Memcached instance in one call in Rails? i.e. cache.set_multi("k1" => "v1", "k2" => "v2") ...
I am trying to install ruby-mp3info. I have the following URL from which I can access the gem in my browser: http://bitbucket.org/moumar/ruby-mp3info/src/ I would like to specify this source while running gem install ruby-mp3info When I run gem install ruby-mp3info --source=http://bitbucket.org/moumar/ruby-mp3info/src, though, I get a me...
So, I'm using Authlogic to manage my users and I've recently added in the act_as_soft_deletable plugin. For various reasons, I would like to be able to "undestroy!" users, but I'm getting a failure in my assert_model_soft_deletes. Here's the unit test: def test_soft_delete_works # will run the model through a destroy and undestro...
I’m trying to set up a recurring billing situation with Paypal using Rails with ActiveMerchant and the ruby-paypal gem. Wondering how the status of subscriptions is commonly managed - IPN? Or a cron job to check the status of all subscriptions? ...
So I haven't been doing this for long but I'm completely stuck on this. I have a model which looks like this (simplified for brevity): class ReqBreakdown < ActiveRecord::Base belongs_to :next_level #nil if lowest level belongs_to :previous_level #nil if highest level belongs_to :requirement_level end I need a way to build these...
Where could I find out the content type for a specific file format/extension? For example, I know that an mp3 can be one of the following content types: 'application/mp3', 'application/x-mp3', 'audio/mpeg', 'audio/mp3' What would be the content type for a zip file? Where would I find out that information for other content types? I ne...
I created a webpage and a XML REST service. 0. I would like to know how errors are handled in Rails (general). 1. Let say that a controller does not exists and I would like to redirect a user to a default "Page not found" address (website) or show a default error status code (REST). 2. What is a best practice for handling controlle...
I'm building an app to learn Rails, and I'm not sure how to go about this. I have a form, where the user enters some data. The data is validated, and a server side process should start ( the process may take from 5 minutes to 2 hours ). I'd like to be able to know the state of the process at all times and to be able to kill it. The thi...
How would I validate a field only if another has been filled out In Ruby on Rails 2.3.5? ...
I'm getting the error: wrong argument type nil (expected Data) Here's my code (names have been changed to protect the innocent ;) ): old_foos.each do |foo| foo.bars.each do |old_bar| if new_foo.bars.any? {|new_bar| new_bar.name == old_bar.name} #assume new_foo is properly set check = 1 end end end if check == 1 d...
Right now I'm dealing with an issue regarding an intense acts_as_tree MySQL query via rails. The model I am querying is Foo. A Foo can belong to any one City, State or Country. My goal is to query Foos based on their location. My locations table is set up like so: I have a table in my database called locations I use a combination of ac...
I have two models: Album and Track. Album has many tracks, and Track belongs to album. I'd like to have the ability to create as many tracks as needed while creating the album, similailiy to railscasts episode 197. Unlike the railscasts episode, though, the Track form contains both a title and a description - both are required. Right n...
I would like to display a line of text only if an object called @foo is set. In my view, I'm trying something like this: <% if [email protected]_record? || [email protected]? %> Foo is not a new record or nil <% end %> But this fails, returning You have a nil object when you didn't expect it! I'm pretty sure this happens because of the new_record? ...
How would one get the contents of the 'value' attribute of a select tag, based on content of the select tag (i.e. the text wrapped by option), using Nokogiri? For example, given the following HTML: <select id="options" name="options"> <option value="1">First Option - 4</option> <option value="2">Second Option - 5</option> <op...
Hi, Can you one please guide.... i want to implement Testing in my Rails application.... i never do that before.... so i don't know how to implement testing. can any one please tell me is their any link should follow for step by step process ... please.. Thanks in advance ...
Hi I'm using Mocha for a Rails project. I'm new to TDD so please forgive me if this is a stupid question. If I have this @client.expects(:create_config).once.returns(true) then am I right in assuming that the code in create_config() won't be run and instead true will just be returned? ...
We have a workflow need to be tested. So there are so many branches (pathes) need to test Now we using shoulda contextual test like this: context "workflow one" do setup do #do something end context "branch 1 succuess" do should "something" do end context "branch 2 succuess" do should "something" do ...
Hi all, In my Rails application I have a separate process (BackgroundRb) to delete all transactions which are not successful and it must be run after every five minutes. But in BackgroundRb, it runs a database check after every second though my query executes periodically at the specified time(after 5 mins). So my question is what is th...
I have a query which I've been using for sometime however I have a new scenario which I'm not sure how to handle. The query below extracts avg pricing from a table called availables. The problem I have now is that, the data which is contained in this table can come from one of two sources. So I added a source field to the table. Th...
It's in my understanding that I can specify a layout for a controller by putting layout 'mylayout' in the controller file. I further understand that I can specify certain actions that the layout will be invoked for with :only and :except as such: layout 'mylayout', :only => [:index, :new] or layout 'mylayout', :except => [:ind...