The MySQL database used by my Rails application currently has the default collation of latin1_swedish_ci. Since the default charset of Rails applications (including mine) is UTF-8, it seems sensible to me to use the utf8_general_ci collation in the database.
Is my thinking correct?
Assuming it is, what would be the best approach to ...
On occasion, my local Rails app loses its connection to MySQL. I get some error that the connection failed, but if I just refresh the page, it works fine. This has never happpened in my STAGE or PROD environments (I deploy to Ubuntu), so it has not been that big a deal.
Does this happen to anybody else? Is there something I can do to fi...
I'd like to use Rich Text Editing in place on forms in order to let admins change instructions. What are the best options for doing this?
[To be more clear - the admins are non-technical but may want to control some formatting without using markup or with as little markup as possible. What I'd like is for them to be able to edit inli...
OK, so instead of writing a whole bunch of access control specs, and duplicating them across many of my spec files, I'm looking to create a custom matcher. So instead of this:
describe "access control" do
it "should prevent access by non-logged-in users"
it "should prevent access by normal users"
it "should prevent access by edito...
Can anyone suggest a tutorial or sample code that implements a nested set (or similar ordered tree structure) with associated Javascript that facilitates drag and drop? I'm looking for both the display code (view) as well as the AJAX backend controller which writes the tree to the database on change.
I want it to represent a multi-layer...
In a project which uses restful_authentication with acts_as_state_machine and email activation, I get a double render error whenever a user does the activation action from the email link.
I'm using the default
def activate
self.current_user = params[:activation_code].blank? ? false : User.find_by_activation_code(params[:activation_c...
I'm building an app in Ruby on Rails, and I'm including 3 of my models (and their migration scripts) to show what I'm trying to do, and what isn't working. Here's the rundown: I have users in my application that belong to teams, and each team can have multiple coaches. I want to be able to pull a list of the coaches that are applicable...
My rails app is in a svn repository, but several of the plugins are installed through git and later added to the svn repo. How can I update these plugins? I can't seem to get script/plugin update to do anything. I'd really like to update activemerchant to get rid of the Inflector warnings.
...
I am currently trying to program my first ajax interface using Rails.
The application currently shows a table populated with list items. The user has to approve or reject each of the list items. I currently have an edit link at the end of each row that shows a form in which I can approve the list item.
I am thinking on using a checkbox...
So what's the best way to create new tables in a Sqlite database in Rails 2. I have created the database using rake db:migrate command. So should I write individual sql scripts to create a database or use rake somehow. I don't need scaffolding.
...
I think it important to have an "undo" method ala gmail when destroying records instead of displaying an annoying popup that says, "Are you sure?".
The way that I've implemented this is to have a "deleted_at" timestamp column in the model which gets timestamped when destroy method is called
def destroy
@foo = Foo.find(params[:id])
...
I'm having a quite complex model with many fields, has_many associacions, images added by image_column etc...
New object will be added by multi page form (8 steps) - how shoud I accomplish validation and propagation between those steps?
I think validation_group could be useful for defining validations for each step, what about overall ...
An answer to a question of mine on DB design suggested something called single table inheritance. I've done a bit of searching on that, but I can't seem to find that much clear information on it.
Basically what I seem to understand from it is that you have a big table with all the fields in it and also a type field - and then your ORM l...
I'm creating a bunch of migrations, some of which are standard "create table" or "modify table" migrations, and some of which modify data. I'm using my actual ActiveRecord models to modify the data, a la:
Blog.all.each do |blog|
update_some_blog_attributes_to_match_new_schema
end
The problem is that if I load the Blog class, then m...
I'm looking to get started building a project and want to use RSpec from day one. My Ruby background is limited, however, I do have a good understanding of MVC and the structure within Ruby.
In doing some research for books and tutorials, I've found no currently published books, and have found no tutorials that give a good "hello world"...
Running rake db:migrate followed by rake test:units yields the following:
rake test:functionals
(in /projects/my_project)
rake aborted!
SQLite3::SQLException: index unique_schema_migrations already exists: CREATE UNIQUE INDEX "unique_schema_migrations" ON "ts_schema_migrations" ("version")
The relevant part of db/schema.rb is as follo...
Hi,
I'm interested in hearing your opinions in which is the best way of implementing a social activity stream (Facebook is the most famous example). Problems/challenges involved are:
Different types of activities (posting, commenting ..)
Different types of objects (post, comment, photo ..)
1-n users involved in different roles ("User ...
I want to just store the year in one of my models. At the moment I just have a database field called year of type date, but it seems to want to take a whole date (yyyy-mm-dd) rather than just a year.
What's the best way to store this? In a date field but using some way of just getting it to store the date bit (in which case, how?), or i...
Hi, i'm having a problem to create a text_field without a method association. Maybe i even don't need it :-)
I have two radio_buttons associated to the same method:
<%= radio_button :comment, :author, "anonymous" %> Anonymous <br>
<%= radio_button :comment, :author, "real_name" %> Name <br>
What i would like to do is to have an text_...
Especially when considering a fresh Rails project, what does your version control and deployment workflow look like? What tools do you use?
I'm interested in answers for Mac, *nix and Windows work machines. Assume a *nix server.
I'll edit for clarity if need be.
...