I've got a table that includes a column named "valid". This has caused a problem after updating to Rails 2. ActiveRecord is expecting "def valid?" to do validation, not return a boolean value from the database.
How do I work around this problem? Is renaming the column my only option?
...
Hello, I am writing a document for a Rails application that I wrote.
Apart from a word document, I need it to be a web document as well. And since I do not have a lot of time, I was wondering if there is a CSS framework that will help me facilitating the process.
So is there a CSS framework that is specifically designed for documentat...
I've got a problem that's causing me some headaches and I could use some ideas on how to investigate/fix it.
Setup:
I'm running a Rails app (Apache2 w/ Passenger) on server A (Rails.A)
I'm running the master DB on a dedicated DB server B (DB.B)
I'm running a slave DB on server A (DB.A) with standard MySQL replication (just for backup ...
I have a select_date that I want to restrict the months that a user can select.
<%= select_date(Time.now, :order => [:month, :day, :year ], :datetime_separator => '-', :time_separator => ':', :discard_seconds => true, :discard_minutes => true, :start_month => Time.now.month, :end_month => Time.now.month +1, :start_year => Time.now.year,...
Hello, my problem is that in my app I want to generate the gettext .pot file with rake but I'm getting a file with no keys, only the header text ("Some descriptive title. Copyright (C)...").
I'm using the task gettext:find getttext_18n_rails. I tried before with the classic updatepo task but was the same. Perhaps am I missing any gem?
...
What's the best way to keep users from sharing session cookies in Rails?
I think I have a good way to do it, but I'd like to run it by the stack overflow crowd to see if there's a simpler way first.
Basically I'd like to detect if someone tries to share a paid membership with others. Users are already screened at the point of login fo...
How can I make this work in Rails 2.3?
class Magazine < ActiveRecord::Base
has_many :magazinepages
end
class Magazinepage < ActiveRecord::Base
belongs_to :magazine
end
and then in the controller:
def new
@magazine = Magazine.new
@magazinepages = @magazine.magazinepages.build
end
and then the form:
<% form_for(@magazine) d...
Following some code in Agile Web Development book, theres a method to redirect back to the last viewed page using redirect_to(:back), however when I do that it simply returns back to the page it was on.
Whats the best way of getting the desired result to work? Am I doing something wrong? My code:
def update
@user = current_user
if @use...
I am writing an app that has different parts running on multiple servers. As a result, I have a ruby file filled with global values, which contain the IP addresses of the machines on which each part is running.
The app has a Rails front end that connects to a remote database (on one of the other servers). Is it possible to make use of ...
is there a way to get the referer with the anchor from the referer page..
the situation is - i have a search page which loads results (users) below the search box using ajax. i am changing the hash/anchor on the fly when the search keyword is typed in.
so it becomes http://localhost/users/search#foo
the user gets link in the ajax res...
hi,
I have two models, user and group. I also have a joining table groups_users.
I have an association in the group model:
has_many :groups_users
has_many :users, :through=> :groups_users
I would like to add pending_users which would be the same as the users association but contain some conditions. I wish to set it up as an associatio...
Hi,
say I have a text field like the following in a view called 'search':
<%= text_field_tag(:lookup) %>
how do I submit this ':lookup' value and pass it into the controller called 'search' and assign it to a variable?
It's a basic problem, but being a noob, it's difficult ;)
...
I have all the time zone information that is needed and it saves all of the information correctly according to this railscast. Everything works great for all the normal purposes like displaying time's in a table, however I am wondering how I can convert the following to the current_users saved time zone.
I have a finds the total number...
Hi, This is a pretty basic question but I can't find a good answer for it. I have a page in my Rails app where there are many objects that can be 'flagged'. Clicking the flag button should display a little box with a confirmation, little form, etc. The trouble is I can't figure out how to do this using RJS templates.
I've been usin...
Sorry for such a trivial question, but I'd feel silly building this if it already existed.
I have a vague memory of there being a Rails helper that could turn ['one', 'two', 'three'] into "one, two, and three", but I could be totally making things up. And I can't quite figure out where in the API to look since it's not in the TextHelper...
I have a Rails app that archives high-res images (and thumbs) on S3 (via the Paperclip plugin).
I would love to allow users to download multiple high-res files with a single download. Is it possible to create a .zip/.tar file on S3 without first copying them back to the server? Our app runs on a large dedicated box and I'd love to save...
Hello all,
Just trying out Postgresql for the first time, coming from MySQL. In our Rails application we have a couple of locations with SQL like so:
SELECT * FROM `currency_codes` ORDER BY FIELD(code, 'GBP', 'EUR', 'BBD', 'AUD', 'CAD', 'USD') DESC, name ASC
It didn't take long to discover that this is not supported/allowed in Postg...
I've come across a weird bug for ie7 where the css styles get applied differently when I access "/400.html" and "/500.html" directly as opposed to being redirected to it by a controller.
The controller code for redirection is:
respond_to do |format|
format.html { render :file => "#{RAILS_ROOT}/public/404.html", :status => "404 Not ...
I have Addresses, Lists, and AddressListMemberships.
In this particular application there are over a thousand Lists and many thousands of Addresses.
I've implemented a UI page to let users control a List's Addresses. I've added these actions...
class ListsController < ApplicationController
# ...
def add_address
@list = List....
Still new to Rails.
I'm certain there's a naming convention for what I'm trying to do here.
You've got posts, and then you've got tags (I'm not actually making a blog but this a scenario we're all familiar with).
I'd set up my tags like this:
ruby script/generate scaffold tag name:string
Then I'd create a linking table like this:
...