Sqlite3 by default sorts only by ascii letters. I tried to look in google, but the only thing I found were informations about collations. Sqlite3 has only NOCASE, RTRIM and BIARY collations. How to add support for a specific locale?
(I'm using it in Rails application)
...
Is there a Railsy way to convert \n to <br>?
Currently, I'm doing it like this:
mystring.gsub(/\n/, '<br>')
...
I implemented the YUI rich text editor and I would like to get rid of the <html>, <body> and DOCTYPE tags as soon as I save the content from the editor. I know I could do this afterwards by parsing the HTML, but there must be a better solution.
Right now this is saved when I edit a text in the YUI editor:
<!DOCTYPE html PUBLIC "-//W3C/...
I'd love to use render :json but it seems its not as flexible. Whats the right way to do this?
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @things }
#This is great
format.json { render :text => @things.to_json(:include => :photos) }
#This doesn't include photos
format.json { render :js...
Can I create tables in two databases using db:create? For example, can I have entries in database.yml for one_development and two_development and have both get created by rake db:create? I know rake db:create:all works -- I am just wondering if there is a way to segment what is created depending on the RAILS_ENV?
...
By code block I mean:
def callBlock
yield
yield
end
callBlock { puts "In the block" } #this is the block
...
class AdminController < ApplicationController
scaffold :product
end
Above code works properly in Rails 1.2. But for the above mentioned code it gives error method missing 'scaffold' in Rails 2.2.2. Above code is used for dynamic scaffolding in Rails 1.2. Is this dynamic scaffolding supported in Rails 2.2.2?
or do I need to use ruby...
I am putting together a REST API and as I'm unsure how it will scale or what the demand for it will be, I'd like to be able to rate limit uses of it as well as to be able to temporarily refuse requests when the box is over capacity or if there is some kind of slashdotted scenario.
I'd also like to be able to gracefully bring the service...
Hi,
Is it possible to run some PHP pages at "example.com" AND also run a rails application at say "test.example.com" on Dreamhost? Has anyone done this?
Or do I need to run rails apps on separate domains?
Thanks.
...
Is it possible to change a html tag attribute value from an RSJ template?
I know that there is a page.replace_html method, but it is not very useful in my case, since I have lengthy values of various attributes (such as alt, title of an image).
What I want is change src attribute of a img tag in RJS.
Is that possible at all?
Thank you.
...
Hello,
I'm thinking about a social networking-site. My user-model should have an attribute "eyecolor", which could be set on a view-page with a select-box/dropdownlist.
My question:
-> should I make a AR-Model or should I use a global Hash/Constant for the data?
Is there a best practice for "static-models"?
And how do I associate foll...
I just found out about JRuby, and I like the idea of running Ruby on Rails and being able to call Java libraries.
I would like to know about some experiences with running enterprise production applications in JRuby. Are stability and performance acceptable?
Thanks.
...
I have 3 models: parent-companies, companies and contacts that I'd like to list then all on one index page with 3 different partials depending on the model.
Is there a clean way to do this??
...
This problem has been killing me. I played around with Ryan Bates complex forms, but I can't quite figure out my problem.
I have this schema:
Location has_many :targets
Target has_many :target_classifications
All locations are shown on the page. A user may create a target for any location dynamically through jscript, which then adds...
I followed the instructions found on the github page exactly. I would post some of my configuration but it matches what's found here on http://github.com/nkallen/cache-money/tree/master
The error reads as follows:
/!\ FAILSAFE /!\ Thu Mar 05 16:45:09 -0500 2009
Status: 500 Internal Server Error
undefined method `indices' for nil:...
I am using Facebooker with Rails to connect my application to Facebook. I can direct the user through the authorization process and through the process of granting offline access to my application.
How do I actually go about accessing the information offline? Is there a way to request a session_key that does not expire that I can us...
Hi All,
I have a controller action that allows a user to download a file with an extension of .ppt . It's not really a powerpoint binary, just an xml-ish format that powerpoint can read. the file is downloaded from the show action of a controller called ElementsController, but the show action is not actually defined in the controller, t...
Hello
I am trying to use my join table "showing" to get a list of movies
I was trying to use this code but it does not work.
@showing_list = Showing.find_sorted_showings("time")
@movie_list = @showing_list.movies <-- NoMethodError
Here is my Showing class
class Showing < ActiveRecord::Base
belongs_to :movie
def self.find_s...
Ruby 1.8.6, Rails 2.2.2, OS X Tiger
My Test::Unit tests started returning the error below. The relevant line seems to be:
`load_missing_constant':
Expected /Users/ethan/project/mtc/webcalendars/app/models/calendar.rb
to define Calendar (LoadError)
The file mentioned, calendar.rb looks fine. I can't find any errors in it. I trie...
The following db design example is given in the Agile Rails book to teach the has_many :through code...
[Article]----<[Readings]>----[User]
This is all quite easy to understand at first. However, I have a situation where the following db design might be used:
[Genre]-----<[Article]-----<[Readings]>-----[User]
Now here is my questi...