I have User, Game and GameView. GameView describe what games users have seen. Trouble is I can't figure out what conditions should I use to fetch unviewed games.
class User < ActiveRecord::Base
has_many :game_views
has_many :unviewed_games, :through => :game_views, :source => :game, ???what conditions???
end
class GameView < Active...
Hi all! I am building a survey page where users have a limited time to answer all their questions. The time given is stored in the model as @test.time_allowed, which is an integer representing seconds.
I need to have a simple and non-user-tamperable way to get a timer to display on the view and execute a controller action when it winds ...
how to validate a given date
...
For my rails site, when somebody attempts to delete an item, I wish to pop up a custom div (as opposed to a javascript alert box) asking for confirmation before doing so.
At the moment, the way that I am doing this, is that clicking on the delete link will call a function (in application_helper.rb) as below:
def show_delete_box(objec...
I'm trying to get a text field that my users can enter in something that is parsable by the Chronic gem. Here is my model file:
require 'chronic'
class Event < ActiveRecord::Base
belongs_to :user
validates_presence_of :e_time
before_validation :parse_date
def parse_date
self.e_time = Chronic.parse(self.e_time_before_type_...
Hi,
I am sending out a confirmation email on save. When an email address in the 'CC' list is invalid I get the following error
Net::SMTPFatalError (550 5.1.1 ... User unknown
):
and the transaction is not saved even though it is called from the after_save method in the model observer. Should'nt the transaction be saved before the erro...
I am trying to install rspec-rails on Ubuntu but I am encountering some problems.
Here are my exact steps:
1) Changed my Gemfile to:
source 'http://rubygems.org'
gem 'rails', '3.0.0.beta4'
gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
group :development do
gem 'rspec-rails', '2.0.0.beta.17'
end
group :test do
gem 'rspec', ...
Supposing I had a multi-form page such as:
<form id="A" class="jaxy" ... />
<form id="B" class="jaxy" ... />
<form id="C" class="jaxy" ... />
Then I have some JQuery
$('.jaxy').live('submit', function() {
$(this).startLoadingSpinner;
$.post(this.action, $(this).serialize(), $(this).stopLoadingSpinner, "script");
return false;
}...
Currently whenever a client wants a website I provide my own CMS however I have been wondering whether a 3rd party CMS may be easier.
At the moment I have built it in ASP.Net & ASP.Net MVC (I'm thinking of moving to Ruby on Rails). A master page has 5 pagecontent areas, top, left, middle, right & footer.
I then create usercontrols such...
Hi ,
I have the rails application. i want to test the performance.so i decided to implement a tool... i download the rawk.rb file from the following URL
http://ckhsponge.wordpress.com/2006/10/11/ruby-on-rails-log-analyzer-rawk/ .
The tool is working greatly i can get the output like the following :
**Top 20 Greatest Standard Deviat...
I have followed steps, described in rack-recaptcha readme.
I have done all the steps, instead of "You have to require 'rack-recaptcha' in your gemfile."
Server is unable to start, because of a following error:
Booting Mongrel
=> Rails 2.3.5 application starting on http://127.0.0.1:3001
/System/Library/Frameworks/Ruby.framework/V...
Hi, I'm using RubyZip to compress a set of images (uploaded using Paperclip) and allow the user to download them in one file, and all works fine until I come to open an image.
It wont display, and trying on Ubuntu I get the error message:
"Error interpreting JPEG image file (Not a JPEG file: starts with 0x89..."
So the user is downlo...
This JSON post works, but if I start clicking them quickly, they start returning 500 errors. I'm guessing this is because they're not queueing correctly, and they fall apart when they can't go out one by one. Is there a way to queue this in JSON?
Here's my button in HAML :
= f.check_box :has_sticker, :style => 'width: 20px;', :class =>...
I was trying to run poller but when i run that i get error as : SCRIPT/poller run
=> connect to localhost failed: getaddrinfo: Name or service not known will retry(#0) in 5
Solution?
...
Hello.
We have RoR application and we are planning to make js interface(extjs or closure) in new version.
Is it possible to use GWT with RoR?
...
Hi,
I use passenger with nginx. I have multiple apps and they talk to each
other. I configure the passenger to host these same apps in both test
and dev environments.
Now the problem is sometimes when I go to the dev environment on app1,
and the app1 talks to the app2, but it hit the app2's test url. If I
use mongrel no such proble...
Supposing a guy doesn't want users to include months or days or anything that remotely sounds like a time in his text area form. Could he use something besides regex to validate that? Is there a built-in API for that? I do use the Chronic gem somewhere else, but if I used it for this purpose, it would probably be out-of-the-box.
Here's ...
I need send an email alert when the price of a product changes.
Is it possible do this with ActiveRecord::Observer or do I need use programming logic in the edit form?
...
Hi,
I am trying to use ActiveResource to consume xml data from a third party API. I can use the RESTClient app to successfully authenticate and make requests. I coded my app and when I make a request I get a 404 error. I added:
ActiveResource::Base.logger = Logger.new(STDERR)
to my development.rb file and figured out the problem. Th...
Hello ,
I am having an rails application,in which I need a css file in such a way that its property can be changed by ruby code.
ex. background_color :<%= ruby code that return background color %>
So a user can set its css property and will be applicable to only that user like a theme.
Thanks!
...