How to tell selenium to use test database?
I'm using selenium-client to run a few tests, but Selenium seems to be using my development database. How can I point it to use my test DB? ...
I'm using selenium-client to run a few tests, but Selenium seems to be using my development database. How can I point it to use my test DB? ...
I have two models: Company and User they have a has_and_belongs_to_many relationship. I'm using active resource with a method to get all users of a company: def users @company = Company.find( params[:id], :include => [:users] ) render :xml => @company.users.to_xml(:include =>[:companies]) end The only problem is, on the other...
I installed nkallen's cache-money gem per the github readme. I run into RecordNotFound exceptions during my tests. If I comment out the contents of config/initializers/cache-money.rb, the tests run fine. My cache-money.rb file is identical to that on the github instructions. Here is the contents of my config/memcached.yml: development:...
I am stumped with this problem. ActiveSupport::JSON defines to_json on various core objects and so does the JSON gem. However, the implementation is not the same -- the ActiveSupport version takes arguments and the JSON gem version doesn't. I installed a gem that required the JSON gem and my app broke. The issue is that I'm using to_js...
In my Rails app, I have a section called Situations, which is basically a textual description of a situation. But there are several of them. I want to be able to display only one at a time and each one on its own page (the newest created ones first), and then at the bottom of the page I have links that go to Older and Newer situations. ...
How do I make an autocomplete text field like the one here at Stack Overflow for the Tags fields? I want to use it for my Rails app. ...
In ruby on rails when doing session[:foo] = nil it leaves an entry named :foo in the session object. How can you get rid of that single entry from the session object? ...
I am starting to develop a site which basically acts as WordPress MU, in the sense that a user can signup and have their own blog. I will be coding this in Rails, however I am hoping to be able to utilize wildcard subdomains, so I can use the format such as blog.example.com. I've done some searching but I can't find any good resources. ...
I have a user registration form, and wanted to write a human detecting "captcha" into my register method. I decided to create a simple math question for users to answer (this should work for my purposes). How do I write a validation that checks the value of this field? I wrote a validate method in my model file as follows: def validat...
I have a model and I would like to store ids of associated objects (denormalize) for performance reasons. I have a method which looks like this: def cache_ids self._tag_ids = self.tag_ids end I thought I could just run it on before_save, however there is a problem - some of the associated objects might be new records, and therefore ...
I am using will_paginate and sort helper for pagination and sorting resp.. But im facing one problem while sorting that when im on page 2 or 3 or any other page than first page. It redirects to the first page and sorts the first page only. please help me how to sort all the records and go back to page where I was. ...
Rails provides a very useful console ('script/console'). I write a ruby file and run it in the console using require foo.rb. It works fine the first time, but the second and next require foo.rb does not run my script (require does not reload it). Do you have any tips/tricks? ...
Took me a while to track down this error but I finally found out why. I am modeling a card game using the Rails framework. Currently my database looks (mostly) like this: cards cards_games games ----- ----------- ----- id id id c_type card_id ... value game_id other_stuff ...
map.resources :users map.namespace :formulator do |formulator| formulator.resources :submissions end I want to have submissions be a nested resource of users, but I'm not sure how to since it's namespaced. ...
Say if I have a set of objects contained in @set. Each of these objects has a description method which will return some text that I want to display on individual pages. How do I use will_paginate to paginate this? The examples I've seen so far such as: @articles = Article.paginate :page => params[:page] look like they are referring t...
Is it possible to make some kinda this association: User model: has_many :goods, :through => :assignments has_many :goods_want, :through => :assignments, :source => :good, :conditions => "assignments.type = 1" Testing in console u = User.first u.goods_want << Good.first u.save This is being logged: INSERT INTO `assignments` (`goo...
I often hear about Flex being combined with web frameworks on the backend. The idea being that Flex serves as the presentation framework while the web framework (Django/Rails) does the database lookups and sends the data to Flex to present in the form of XML. However, is there ever a situation where Flex and Python/Ruby would be combine...
Hi all, Will always return true and erase the entire array <% users.delete_if do |user| %> <% false %> <% end %> On the other hand <% users.delete_if do |user| false end %> works and does not delete the array. Can i somehow use the delete_if statement in my view and still be able to insert html? Thanks ...
When I want to run all my unit tests, I run rake test:units. To run all my functional tests, I run rake test:functionals. If I want to run all the test cases in one file, I run ruby test/unit/username_test.rb A few people have been telling me I should run rake instead such as rake test:units TEST=test/unit/username_test.rb For runnin...
I am making an activeresource call to a service, and I'd like some custom error messages as feedback. I have some validations that aren't normal model validations, so I can't just return @object.errors. So, for instance, one of my validations is this. Two objects have a many to many relationship, but I want to restrict one object to o...