I'm rewriting my rails application to work with rails 3 and when I migrate the acts_as_taggable_on migration I get this error:
== CreatePosts: migrating ====================================================
-- create_table(:posts)
rake aborted!
An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: table ...
This is my date 20100816 and it integer date.
I want to display it like 08/16/2010.
What's the best way to do it?
...
Hi All,
I have the following scenario
I want to add methods dynamically to a controller. All my method names are in a table . Please refer the following example
-table (method_names)-
1 - Walk
2 - Speek
3 - Run
and I have a controller
class UsersController < ApplicationController
def index
end
end
Inside this index act...
Hi, I am trying to configure SSL on my localhost using apache and phusion passenger. I am using virtualhosts.
I have the below configuration in sites-available/myapp
VirtualHost *:80
ServerName myapp
DocumentRoot /home/madhu/ror/myapp/public
RailsEnv development
Directory /home/madhu/ror/myapp/public
AllowOverride all
...
In one of my views I apply a layout to a block of code:
# In app/views/sessions/new.html.erb
<% render :layout => 'home/shadow_box' do %>
#... code for sign in form here
<% end %>
The layout is a div that has png shadows on all four sides.
Since I use this layout all over my site, I want to pass a variable to the layout that spec...
Hello. I have a resource called Book, then I have domains like:
domain.com/books/272
But I want to change it to
domain.com/stories/272
Only for the URL, don't need to change controller, classes etc.
In the routes I have
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
map.root :con...
I am using a YAML file for configuration in my rails app and a few entries in the file are subsets of future entries, eg -
domain: domain.com
name: jack
email: [email protected]
To make this more efficient, is something like this possible in YAML ?
domain: domain.com
name: jack
email: jack@${domain}
...
I have a rails app and from the admin section of the site I'd like to be able to enable / disable certain settings such as serving ads or embedding of Google Analytics tracking code.
Is there a best practice for this in Rails? One thought was creating a settings table and storing values in it.
...
What is the recommended approach for finding multiple, unique associated models for a subset of another model? As an example, for a subset of users, determine unique artist models they have favorited.
One approach is to grab the users from the database, then iterate them all quering for favorites and building a unique array, but this se...
I am on a tight timeline with minimum resources for a project.
I would like to practice test driven development for this project, but realistically, i would not have time to learn any of the more sophisticated frameworks like Cucumber, Rspec, etc. And it would probably be counter-productive at this point anyway
What do you recommend i...
I need a simple and flexible autocomplete jQuery plugin. In your experience, which jQuery plugin has the best performance and flexibility?
...
I'm currently running on a Ruby on Rails app with Authlogic handling my authentication and user management.
I'm struggling to find up to date information on the best way to add 3rd party login methods to my site, supplementing the standard sign up and login. There are a number of tutorials out there, but all seem to be outdated or inco...
I want to output one of those select fields for the user to select their timezone. My User model saves the timezone as an integer in seconds. But I can change that if it's not practical.
Something like this:
<select>
..
<option value="x">+9:00 (Darwin, Australia)</option>
<option value="x">+10:00 (Sydney, Australia)</option>
..
</s...
What is a difference between named_scope and named_scope + lambda Ruby on Rails code statements?
named_scope :with_avatar, :conditions => ['avatar IS NOT NULL']
and
named_scope :date_from, lambda { |date| { :conditions => ['created_at >= ?', DateTime.strptime(date, '%d.%m.%Y')] } }
...
I'm adding data to a db and I only need to check for duplicated data within the last 30 minuets or so.
Data is getting added at about 10 entries per minuet so I only need search about 300 records. How can I get this in conditions with rails Model.find(:all, :conditions => [])?
...
Hi Everyone,
Is it possible to change a field that's a string to an integer without clearing the data already entered?
The current db structure for the table in question is:
create_table :people do |t|
t.string :company_id
Is this possible using migrations?
I'm thinking maybe in the migration drop the old field, create a new one t...
I have code like this in a Rails 3 app I'm working on
<% @positions.each do |position| %>
<tr class="<%= cycle("", "alternate") %>">
<td><%= position.name %></td>
<td class="actions">
<%=link_to 'edit', edit_position_path(position), :class => 'edit' %> |
<%=link_to 'delete', position_path...
Hi,
I'm building a custom CMS which allow user to post message to it. Messages are short and like tweets.
The problem is that these message are moderated by real moderators. And there are multiple moderators working on the messages stream at the same time. And my concern is that what if these moderator are processing a same message. T...
Lets see controller:
def destroy
if session[:user_id] && User.find(session[:user_id]).is_admin
@exam = Exam.find(params[:id])
@exam.destroy
else
redirect_to :back, :notice => "You cant do that!"
return
end
redirect_to :root
end
its in Exams controller
But i want analogical...
I've got two files in app/views/users
-rw-r--r-- 1 create.html.erb
-rw-r--r--@ 1 new.html.erb
With autospec running and all my tests passing, I touch 'new.html.erb' and and growl notifies my that my tests can't run and autospec outputs:
0 examples, 0 failures
If I start autospec again all my tests pass.
If I touch 'create.html.erb...