Is it possible to configure Rails so caches created with caches_page survive a Capistrano deploy? Ie, can I configure the cache to be saved into a shared directory rather than in the public directory?
...
Let's say I have two models:
class Model1 < ActiveRecord::Base
has_many :model2
def save
self.attr = <sth. complex involving the associated model2 instances>
super
end
end
class Model2 < ActiveRecord::Base
belongs_to :model1
end
The statement in the overwritten save method will issue a complex query (using find [or a...
I have a list of values (Beginner, Intermediate, Advanced, Fluent, Native) that I would like to:
act as the model for a SELECT list
act as a model to convert ids to values in a HTML table
use in multiple controllers and views
keep in an order that preserves the business rules (ordered by skill level)
localize at some point in the futur...
I have began playing with Rails 3 beta and I am trying to do my usual starter project. I create a simple list of projects, but use ajax requests for the app's navigation. In Rails 3, my usual code does not work for the basic scaffold, I receive an
ActionView:MissingTemplate (Missing template projects/new with {:format=>[:js]}
Here is...
I'd like to paginate through a randomly sorted list of ActiveRecord models (rows from MySQL database).
However, this randomization needs to persist on a per-session basis, so that other people that visit the website also receive a random, paginate-able list of records.
Let's say there are enough entities (tens of thousands) that storin...
hi
I need to pass image as byte array to .NET SOAP web service.
Can anyone give me example how to convert uploaded image file to byte array using ruby?
...
I can't seem to find it anywhere... How do you delete/destroy/reset user's session in rails? Not just one value but the whole thing.
...
I have some projects. Those projects have users through memberships.
However, those users belong to companies. Question is, how do I find out which companies can access a project?
Ideally I'd be able to do project.users.companies, but that won't work.
Is there a nice, pleasant way of doing this?
...
I'm working on creating a tests, and I can't figure out why the creation of a model from a form_for is failing in the test but works in real browsers. Is there a straightforward way for me to see what the problems are in the model creation?
Even better would be, is there a straightforward way for me to test the error outputs that I acc...
It's pretty easy to sanitize HTML and strip ALL instances of a HTML tag using Rails helpers...
But how do you just remove ONE tag? In this case, I'm using a WYSIWYG editor that insists on wrapping all my text in a <p> tag. I want to remove this parent tag without stripping out any other <p> tags within the content of the text.
I know I...
I know you can redirect subdomains to a different server, but can you do the same with folders?
Say I have example.com. I can redirect mysubdomain.example.com to a different server, but can I redirect example.com/mysubdomain to a different server? I'd like to host a rails app in that folder on a site that runs php while still maintainin...
I' trying to fix this for hours...
I have this on a controller rspec test:
it "show action should render show template" do
task = Task.make
task.mission = Mission.make
get :show, :id => task
response.should render_template(:show)
end
But it fails rendering the view because of this:
<%=h @task.mission.name %>
I ...
I'm a rails novice and just finished my first rails app(as far as I can tell). Now I'm at the deployment stage and find myself utterly confused--especially because I'm deploying from a windows machine.
I bought the pragmatic book on deployment and it seems a little out of date since they're recommending subversion instead of Git.
What ...
Say there are multiple requests in a integration test, some of them are local sphinx calls(locator for example).
Should we just stub out the entire response of these sphinx call, or, since it is a integration test, we want to excise the entire test without stubbing. If that is the case, how do we still keep test independent in the situa...
So i am trying to do this
Order.find :all, :conditions => "org = 'test org'"
what ends up firing is
SELECT * FROM `orders` WHERE (org = 'test org')
the whitespace in the argument gets stripped. what am i missing.. im really stumped here. please help!
...
I have a ruby on rails app running a server and sometimes it needs to be taken down for updates/etc. As of now, one way I see to have a general display screen during update periods (when the app is down) is to substitute the files within /srv/www/ directory to just have it display a general screen everywhere that the user could possibly...
I have a table Coupon with a field expired_at, which is of datetime type, and before I save the record, I want to change the zone part of the field according to the user's choice. Say,
c = Coupon.new
c.expired_at = DateTime.now
c.expired_at_timezone = "Arizona"
c.save!
and in the coupon.rb
class Coupon << ActiveRecord...
I recently tried to update the active scaffold to the master version under rails 2.3.5, ruby 1.8. I also added :active_scaffold => true, in my routes.rb, for the resource that I needed.
The scaffold works in the sense that it displays the first page but other needed functionalities are non-responsive: sorting, search, pagination.
I tri...
How can database views be tested in Rspec? Every scenario is wrapped in a transaction and the data does not look like it is being persisted to the database (MySQL in my case). My view returns with an empty result set because none of the records are being persisted in the transaction. I am validating that the records are not being stor...
I wrote a little monkeypatch to the Rails MySQLAdapter and want to package it up to use it in my other projects. I am trying to write some tests for it but I am still new to testing and I am not sure how to test this. Can someone help get me started?
Here is the code I want to test:
unless RAILS_ENV == 'production'
module ActiveR...