Pass Parameters to Rails Unit Tests
I was wondering if there is a way to pass arguments to individual tests in rails similar, or similar in idea, to NUnit's TestCase Attribute. Thanx ...
I was wondering if there is a way to pass arguments to individual tests in rails similar, or similar in idea, to NUnit's TestCase Attribute. Thanx ...
I'm using ruby on rails and use assert_tag to make sure that view has the tag that I expect. When the assert statement fails then it is a pain to find out the value that is appearing in the response text. I know that there is a plugin out there which puts the response text in browser and that makes it easy to debug. Can anyone point me...
So frequently I find myself writing code like this: song.rb: :before_save :cache_sortable_name private def cache_sortable_name return unless name_changed? self.sortable_name = name.sub(/^(the|a|an)\s+/i, '') end I.e., I have a sortable_name database column which holds denormalized data for convenience, and I want to populate it...
I have a project with a RESTful Rails back-end and a Flex front-end, first time for me with this combo and I debating whether to put the flex source somewhere inside the Rails folder hierarchy or making it a separate project. If I do so which folder would be most suitable /lib? Also be doing one click deployment with Vlad which can also...
Just starting to use Ruby on Rails to see what its like. I have a user model with an id and a post model with an adderId. The adderId of the post model should be the user id of the user that created it. How can I relate these with Ruby on Rails? ...
Hi there, Has anyone encountered nested iframes in their Rails/Facebooker application? Basically, every time I click an action or link, the entire facebook page reloads inside my existing iframe, causing two (and more on each subsequent click) facebook borders to appear. I've gone over the instructions three times and changed every set...
I'm trying to create a nested resource with a url scheme along the lines of: "http://example.com/username/...". What I currently have is this: ActionController::Routing::Routes.draw do |map| map.home '/', :controller => 'home' map.resource :session map.resources :users, :has_many => :nodes #map.user '/:id', :co...
Is it possible to use the :with option with remote_form_for? It works with link_to_remote, and the api docs seems to indicate :with should work with any of the remote_ methods. Here is the code I'm using, and output it's producing: Link_to_remote (works): = link_to_remote 'ARGH', {:url => {:action => 'load_item', :id => @policy.i...
I'm writing a Rails app and I've partially integrated in this nice little patch to the in line ajax editor: http://inplacericheditor.box.re/ The problem is, on that page I have tinymce, prototype and scriptaculous included. In Firefox at least there's a big lag when all this stuff is loading. I was hoping to fix it by compressing the fi...
(rails 2.3) I have the following actions in the controller: def new @entity = Entity.new end def create @entity = Entity.new(params[:entity]) @entity.save end I have the following form: #this is the new.html.erb <% for_remote_for(@entity) do |f| %> <%= f.text_field :title %> <%= f.text_field :description %> <% end %> For...
There are a lot of articles in the net about dealing with subdomain accounts in Rails. See this for example. However, I cannot find a simple way of making an account key as the top-level directory of the url. That is, I want to convert my http://account.domain.tld url to http://domain.tld/account So far, the best all-around gem I've c...
I have the following two models: School and User, and a HABTM relationship between them, with a join table. In this join table, the foreign key refering to the User table is not called user_id but student_id. class School < ActiveRecord::Base has_and_belongs_to_many :students, :class_name => "User", :join_table => "schools_students",...
I am trying to implement Authlogic. Registering is fine, it enters all the necessary details into my database.. .. but when I try to log in, it gives me the error: 1 error prohibited this user session from being saved There were problems with the following fields: Password is not valid My password is valid. I am not ...
How do I prevent Rails from always sending the session header (Set-Cookie). This is a security problem if the application also sends the Cache-Control: public header. My application touches (but does not modify) the session hash in some/most actions. These pages display no private content so I want them to be cacheable - but Rails alway...
I've created a method that allows me to return all of the Books. I'd like to limit the books returned to those that are not not loaned. What do I need to add to *available_books* to ensure only unloaned books are returned. Can I leverage my preexisting loaned? method? class Book < ActiveRecord::Base has_many :book_loans has_many :bo...
I am now doing the UI from fresh so I want to make it fully test. Could anyone suggest the correct way to do this and where should be the good place to start? such as Concept, Framework. (I already know some concept of testing) ...
This is my first time using Rails and I was wondering if it's possible to load a has one polymorphic association in one SQL query? The models and associations between them are basic enough: An Asset model/table can refer to a content (either an Image, Text, or Audio) through a polymorphic association, i.e. class Asset < ActiveRecord::...
I am trying to set the following up: www.domain.com goes to the main site (user can register, information about application) foo.domain.com goes to the main application that is customized to the user(subdomain) what is the best way to separate the rails parts? Namespaced controllers seem frowned upon. ...
Hi, i'm working on multisite and I'd like to share session data between two or more sites. I have session id, but what is the best way to retrieve session data from cookie store? Or it will be better to enable ActiveRecord session store and use find_by_session_id method to retrieve session data? Using this way - I need to configure one s...
Hi i want to use WYSIWYG web editor (the editor should have a option for adding videos, images,powerpoint etc..) on to my Rails application. Can any one suggest how can i integrate this editor into my rails application with above feature support. Thanks in advance ...