I am trying to write an rspec test for a controller that accesses a
model Group.
@request.env['HTTP_REFERER'] = group_url(@mock_group) ### Line 49
I get this:
NoMethodError in 'ActsController responding to create should redirect to :back'
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.rewr...
I've noticed that in some lines of rails views, this is used:
<% # Code... -%>
instead of:
<% # Code... %>
What is the difference?
...
I've always been using the cookie-based session store, and never even knew about Cookies until now. So is there any situation where I'd need the cookies hash?
...
When using a subdomain and trying to view anything related to current_user. user is sent to a new session page, the page shows the session is created and gives the option to logout. I can use no subdomain and it works fine.
...
I have a class in which looking up an instance is expensive, so instances are cached:
class Foo
def self.find(id)
Rails.cache.fetch("Foo.#{id}") do
// some expensive lookup, like an HTTParty request, or a long SQL query
...
end
end
end
That works fine until Foos have related Foos:
class Foo
def children
...
Are there any good (preferably free) tools out there?
Can they give accurate estimates that reflect production results when the app goes live?
...
I've been doing html, css and javascript for quite a long time, mostly for my very own enjoyment. I would say I know fairly much, I've created many simple games and apps and experiments with javascript. However there is only so much that is possible to do in the browser, for any more "complete" websites I am constantly confronted with my...
Related to the question asked here -- http://stackoverflow.com/questions/182040/default-segment-name-in-rails-resources-routing.
Having trouble in edge rails trying to generate resources without a namespace prefix (i.e. /:apple_id/oranges/). Using the plugin gives me //:apple_id/oranges?
Any easier way to do this? Maybe a 2.2 issue?
...
Since Rails 2.1, if you define a new column in a migration with the type set to :integer and the :limit set to 5 or more, the column actually created in your MySQL database will be of type BigInt. That's perfect.
But I cannot figure out how to create a table with a BigInt primary key.
Any clues?
...
I am working on a project using rails 2.1.1. With the new release of 2.2.2 I want to migrate to the new version. Is there anything I need to change to migrate my 2.1.1 controllers, views, and models?
...
I have fresh Rails 2.2 install, thing is that everything work fine until I use scaffold generator.
$ script/generate scaffold pages \
title:string description:string content:text
$ rake db:migrate
But when I launch server with this address: http://localhost:3000/pages/ I get this:
NoMethodError in PagesController#index
undefined m...
I know questions of this kind have been asked before, but my situation differs a little.
On my rails app I have to validate the user login against an existing repository and then control authorization to given modules. So, I don't want the solution I go for to generate a model for my users and rely on that. The authetication per se need...
I am building a Facebook App which is heavy on Javascript. For this I have multiple Javascript files. Since in Facebook development, the page is served over a tunnel, there is excessive latency added while requesting multiple javascript files. Is it possible to combine the contents of multiple javascript files at runtime? Having multiple...
Hi, I'm trying to test a method I have in my application, but I don't know how to unit test a method that is being protected from forgery, take a look at this:
def index
@alumnos = Alumno.paginate :per_page => 20,
:page => params[:page], :order => :nombre
respond_to do |format|
format.html # index.html.erb
...
I have library code that overrides Ar's find method. I also include the module for all Association classes so both MyModel.find and @parent.my_models.find work and apply the correct scope.
I based my code off of will_paginate's:
a = ActiveRecord::Associations
returning([ a::AssociationCollection ]) { |classes|
# detect http://dev.rub...
Has anybody done a comparison of the overhead of the various background processing techniques?
Background/RB, Starling, Workling
MemcacheQ
Beanstalk
Background Job (Bj)
delayed_job (Dj)
I will be implementing one of them on a slice and would like to know how much memory they take up so I can factor it into my decision making.
...
I am very interested in learning a Ruby on Rails / Django type web technology but am currently using Windows Server 2008 (for .Net web applications.) I have read that RoR is not very performant on Windows.
Would it be unadvisable to create run a beta web application in RoR on a Windows Web server as far as performance is concerned?
Wou...
I'm developing a sort of personalized search engine in Ruby on Rails, and I'm currently trying to find best way of sorting results depending on user's record, in real time.
Example: items that are searched for can have tags (separate entities with ids), for example item has tags=[1,
5, 10, 23, 45].
User, on the other hand, may have fla...
I have an after_save filter which I dont want to trigger in a specific instance. Is there a way to do this similar to save_without_validation?
Thanks,
...
Hey guys,
how can I achieve the following? I have two models (blogs and readers) and a JOIN table that will allow me to have an N:M relationship between them:
class Blog < ActiveRecord::Base
has_many :blogs_readers, :dependent => :destroy
has_many :readers, :through => :blogs_readers
end
class Reader < ActiveRecord::Base
has_many :...