I am creating a splash page for a rails app which contains an email field for the user to fill up and get notified when the site is completely launched.
What is the best way to go with?
Should I create a new application just for landing page OR should I use the same app with some variable set like ":splash => true" which would give ac...
I created a top level directory called 'maintenance' in my Ruby on Rails application. There's mostly scripts there that I use for my own cleanup/project maintenance. I want to be able to load my models and activerecord so I can query them in my script. What do I have to load at the beginning of the script to get it to properly know my en...
Is there a way to get the current variable?
lets say that i have a "title" attribute in a method and i want to check in with the old value of the variable ?
how could i accomplish this ?
...
Lets say I have i variable var witch is a pointer to another variable named user_id.
How do I puts var such that I can see in the console user_id = (whatever the value is)
Reason why I want to do this, is because I want to write a method called print_debug_block, where you give it an array of variables, and it prints in the following f...
I have a list of Area objects that I'm displaying in a Facebook application. I would like to have a link for editing them, next to each row. I would like the form to appear in a <fb:dialog>, so I created the following partials:
# _edit.fbml.erb
<% fb_dialog("edit_area_#{@area.id}", false) do %>
<%= fb_dialog_title "Edit area" %>
<% fb...
What api's do you use to develop a touchscreen point of system in Ruby?
...
Hi,
I'm running a Rails web app where the authentication system is based on Authlogic and tardate's authlogic_rpx.
The first one handles everything about sessions, the second one does the mapping with RPX/Janrain (which offers the users to sign in with Twitter or Facebook).
All the users are always automatically logged out after a cer...
My search form is triggering this.
undefined method `id_like_before_type_cast' for #<Class:0xb5ffff68>
Here's the line from the form:
<%= f.text_field :id_like %>
...
I've tried reading through various blog posts that attempt to explain alias_method_chain and the reasons to use it and not use it. In particular, I took heed to:
http://weblog.rubyonrails.org/2006/4/26/new-in-rails-module-alias_method_chain
and
http://yehudakatz.com/2009/03/06/alias_method_chain-in-models/
I still do not see any prac...
Hi,
I'm using the Vestal Version Fork here for Rails 3 support: http://github.com/adamcooper/vestal_versions/
The issue I'm having is that the updated_by => current_user is not storing in the versions table on update.
def update
@book = Book.find(params[:id])
respond_to do |format|
if @book.update_attributes(params[:...
Hi,
I have to model an association structure and the association is divided into divisions/subdivisions/sections etc. So I've created a simple Entity-Attribute Model:
I'd like to use rail's single-table-inheritance but it seems like this works only if the type column is a string. My question is how to achieve this with my approach? S...
Hi folks,
I'm trying to write up some cucumber tests to ensure cancan permissions are set correctly, and I'm having an odd problem:
When I log in through the following code, capybara says I've logged in as expected. However, when I then go to a resource which requires the given login, I get CanCan's "not authorized" message. Capybara p...
I was hoping someone would spot why this wouldn't work.
I am getting an error thats being called because the attributes I specify with Factory_Girl are not being applied to the stub before validation.
The Error:
undefined method `downcase' for #<Category:0x1056f2f60>
RSpec2
it "should vote up" do
@mock_vote = Factory.create(:vote...
My site, Rap Genius, explains rap lyrics. I want to create a new site, Rock Genius, that explains rock lyrics – otherwise it'll be the same (same layout, same DB schema; like Serverfault is to Stackoverflow)
What's the best way to do this?
Approach 1: Fork the code
Fork the Rap Genius code, change the relevant parts (e.g., "Rap" -> "R...
Hi,
I'm implementing a live search feature on my website(rails). Everytime there is a keypress, I'm submitting the form. But if the user types several characters, several search requests are sent to the server. I was wondering if there is a way to stop the previous(unprocessed) requests. I want only the last request to be successfully p...
Hi,
I am faced with a peculiar issue with respect to Timezone in Ruby. I want to convert the following
Sat Sep 11 15:15:00 +0530 2010
to
Sat Sep 11 15:15:00 -0400 2010
As you can notice, only the time zone has been converted and no other part has changed. How to do this in Ruby.
...
I'm trying to validate wether a Model.category equals any existing Category name
unless Category.exists?(:name => self.category.downcase)
I had to put downcase in this to ensure all of them were downcased so they could match up as strings. But its a big server hit to update the attribute before_save, and I was thinking of just matchin...
Hello all,
I'm very curious how your Rails apps include javascript. For example:
do you package all your js code into a single file and serve it for all requests?
do you conditionally load certain js depending on controller/action?
what tools or techniques do you use, ie: asset_packager, yui compressor, sprockets, BigPipe inspired imp...
Hi,
I have this strange SQL error when I try to know wether an object is in an array:
@announcement = Announcement.first
puts "YAY" if current_user.announcements_read.include?(@announcement)
Error:
ActiveRecord::StatementInvalid (SQLite3::SQLException: ambiguous column name: created_at: SELECT "announcements".id FROM "announcemen...
I'm using rspec and I'm trying to test whether or not my model y has many x. I've tried all sorts of things, including looping through the methods array, and can't seem to find a good method online. So what should I use?
...