I've got code that does time tracking for employees. It creates a counter to show the employee how long they have been clocked in for.
This is the current code:
start_time = Time.parse(self.settings.first_clock_in)
total_seconds = Time.now - start_time
hours = (total_seconds/ 3600).to_i
minutes = ((total_seconds % 3600) / 60)....
Hi,
Last May at Railsconf on Portland, I went to a presentation where it was argued that, in Rails, Ruby class member variables, like @@foo, are dangerous because they are inherently unthreadsafe.
I researched the question afterward and I never found a link that really fleshed out the question. I would appreciate a pointer to a good ...
What behavior have you had to implement in your Rails applications that you feel could exist nicely as a plugin?
What plugin functionality have you searched for in the past but couldn't find?
What existing Rails plugins could be improved or extended, and how?
...
The models project and category are in a has_and_belongs_to_many relationship. The partial seen below is used on different views to show a dropdown-menu with all the available categories. The projects in the list below the dropdown-menu are shown according to the choice the user made in the dropdown-menu.
Besides other categories, there...
Looking through the rails 2.3 RC1 release note I see this:
# Equivalent of render :partial => 'articles/_article', :object => @article
render @article
So somehow the render method is finding out the that object passed int it is assigned to an instance variable with the name article. How does it do this?
...
In a Rails application, I need a table in my database to contain constant data.
This table content is not intended to change for the moment but I do not want to put the content in the code, to be able to change it whenever needed.
I tried filling this table in the migration that created it, but this does not seem to work with the test...
In my Rails app I am attempting to create a form that allows users to create a bookmark.
<% form_tag( contents_path ) do %>
<input name='item_type' value="Bookmark" type="hidden" /></p>
<h3>Create New Bookmark</h3>
<p>Title:<input name='item[title]' type="text" /></p>
<p>URL:<input name='item[url]' type="text" /></p>
<%= submi...
I'm building a simple blog with comments. There is a Post model and a Comment model. Every interaction between the two works fine except for creating new comments. I'm having an issue in Rails when trying to post a new comment:
wrong number of arguments (1 for 0)
Here are the request parameters (from the stack trace):
{"commit"=>"Pos...
I'm looking for an alternative to Google Apps for sending email from my rails app. (Google limits the number of messages you can send).
Do most people roll their own, or is their a preferred provider?
I'd love to be able to dynamically create addresses for my customers: [email protected]
...
Say I wanted to allow an administrative user to add a field to an ActiveRecord Model via an interface in the Rails app. I believe the normal ActiveRecord::Migration code would be adequate for modifying the AR Model's table structure (something that would not be wise for many applications - I know). Of course, only certain types of fiel...
I'm new to Rails (and StackOverflow), so I apologize if this is a "dumb" question. I've put together a really simple Rails application. It receives data from another server (via HTTP POSTs). I would like to graph the data sent - in particular, I am looking to graph temperature versus time.
I am trying to use Flotilla to generate these g...
The dropdown-menu (built by the select_tag) in my application should call the filter-category-action as soon as the user changes the value in the dropdown-menu AND hits the 'Go' button.
Now I'd like to get rid of the 'Go' button and have an observer (observe_field?) call the filter-category-action as soon as the user changes the value ...
I am looking for a good gem/plugin to convert user-uploaded audio files to different formats. One format in particular that I am interested in is converting to Apple .caf with ima4 compression for inclusion in an iPhone app.
I have been using afconvert on my mac for this so far, but I need to do it on my linux box, server-side. Ideall...
CSS Spriting can really help performance, but it's not the easiest thing to read and maintain. Are there any tools that would let me code the images individually but aggregate them up and replace the HTML with the correct subset of the montage?
I'm specifically thinking a Ruby on Rails plugin, but if there's a package for another langu...
I get an error whenever I try to use the function gets within a rake task. Is there a way to make it work?
The error says, "no such file or directory - (rake task name)"
...
In the documentation I read:
use \A and \Z to match the start and end of the string, ^ and $ match the start/end of a line
I am going to apply a regular expression to check username (or e-mail is the same) submitted by user. Which expression should I use with validates_format_of in model? I can't understand the difference: I've alw...
I need to implement a undirected graph G = (V,E) in Ruby on Rails and thought of building a Vertex and an Edge model where *Vertex has_many Edges*.
As an edge connects exactly two vertices, how would you enforce this in Rails?
Do you know any gem or library that would help implementing such a graph (not intrested in re-inventing the w...
what's the best way to change a subdomains for the duration of an integration test?
jamis buck suggested using host! here:
http://weblog.jamisbuck.org/2006/3/9/integration-testing-in-rails-1-1#12
but according to the rails API, host! only changes the host for the following single request. i'm looking for something like @request.host...
I have a Rails application that I'm in the process of designing. I have a separate model that needs to link to only 2 of one model. Specifically, my "evaluation"s have 2 "member"s, an evaluator, and an evaluatee. They also have a few other pieces of information, too but they should not be relevant to this.
What is the best way to r...
What is the best web server for ruby on rails application? Why?
...