Hi,
I got the following situation: I have an application configuration in my database which is needed on every request. I don't want to query this configuration on every request because of performance issues.
So what I want is to query the data when the application server (mongrel/webbrick/...) starts and store it permanently until th...
Hi guys.
I am deploying a new rails app.
But i have a problem. In my routes file i have the following (at the end of the file):
match '/:id(/*path)' => "websites#index"
in development everything works great! but i am now switching to production and the files in the public directory can not be accessed. For some reason those reques...
I've been having a problem uploading a CSV file to Heroku and processing it. It works fine in my local environment. Just do be clear, I don't need to save the file on Heroku, just access it during the request in order to convert it into a string for processing and importing into the DB.
What I want to do is:
Upload CSV file
Strip out ...
Hello, rails 3 newbie, using Devise for auth...
I want to create the following models:
class Instance < ActiveRecord::Base
has_many :users
has_many :notes
end
class User < ActiveRecord::Base
belongs_to :instance
end
class Note < ActiveRecord::Base
belongs_to :instance
end
To create a new note in the notes_controller.rb
def cr...
Ok so I have an autocomplete field that is making an ajax request every keystroke....which can slow things down alot. If you visit here and use the
email: [email protected]
pass: test12
If you have firebug open and start typing fast you will see all the see all the ajax requests. My question is can i cancel the previous request if there ...
I have a stripped down shopping cart application, currently with one model "cart", the cart id is stored in a session.
the cart controller has this method so we always have a cart
def initialize_cart
if session[:cart_id]
@cart = Cart.find(session[:cart_id])
else
@cart = Cart.create
session[:cart_id] = @cart....
Hello, newbie here...
I have the following models:
class Instance < ActiveRecord::Base
has_many :users
has_many :books
end
class User < ActiveRecord::Base
belongs_to :instance
end
class Book < ActiveRecord::Base
belongs_to :instance
end
I now want to add a BookRevision table, that has the following columns
(id, user_i...
>> events.first
=> #<Bandsintown::Event:0x1037caf98 @venue=#<Bandsintown::Venue:0x1037c9580 @region="Australia", @bandsintown_id="160698", @latitude="-37.8161090", @city="Melbourne Vic", @bandsintown_url="http://www.bandsintown.com/venue/160698", @longitude="144.9725040", @country="Australia", @name="Rod Laver Arena at Melbourne Park...
I am trying to get the following requirement to work. I have a test page that has a Droppable area.
<%= drop_receiving_element(
"basket",
:onDrop => "function(element) { alert(element) }",
:url => { :action => "create" }
)%>
What I want to achieve, is to be able to drop any links from another browser tab/window onto the Droppable ...
>> events.first.datetime
=> Wed Sep 15 19:00:00 -0400 2010
>> Time.parse(events.first.datetime)
NoMethodError: private method `gsub!' called for Wed Sep 15 19:00:00 -0400 2010:Time
...
Hello, I'm real interested in using Vestal Versions with Rails 3. Does anyone know if Rails 3 works with Vestal Versions? I've heard some users are running into issue:
ActiveRecord::DangerousAttributeError: changes is defined by
ActiveRecord" It uses a field in the model called changes. Not sure if
there are plans to fix that or not.
...
Hi everyone,
I am trying to install rails 3.0.0. and am getting this error during install. Anyone have any clue how to work around this?
C:\Ruby187\bin>gem install rails -v 3.0.0
Successfully installed activesupport-3.0.0
Successfully installed builder-2.1.2
Successfully installed i18n-0.4.1
Successfully installed activemodel-3.0.0
Su...
I'm using Sinatra, and I wanted to set up some of the convenience rake tasks that Rails has, specifically rake db:seed.
My first pass was this:
namespace :db do
desc 'Load the seed data from db/seeds.rb'
task :seed do
seed_file = File.join(File.dirname(__FILE__), 'db', 'seeds.rb')
system("racksh < #{seed_file}")
end
end
...
I have a simple has_many through relationship set up:
class Tag < ActiveRecord::Base
has_many :profile_tags
has_many :profiles, :through => :profile_tags
end
class ProfileTags < ActiveRecord::Base
belongs_to :profile
belongs_to :tag
end
class Profile < ActiveRecord::Base
has_many :profile_tags
has_many :tags, :through => :...
Hi, I did something while trying to install the vestal_versions plug-in that ended up creating a vestal_versions directory in my app's root with the following:
- Application
- APP
- DB
- vestal_versions
- ruby
- 1.8
- bin
- cache
- doc
- gems
- specifications
Which if deleted prevents the...
Hi,
I had a quick question concerning css and a template i'm using.
I have two fields in my CSS:
.content
{
padding:10px;
width: 100%
text-align:justify;
font: 9pt/14pt 'Lucida Grande', Verdana, Helvetica, sans-serif;
}
#errorExplanation {
width: 400px;
border: 2px solid red;
padding: 7px;
padding-bottom: 12px;
margin-bott...
Hello,
I am planning a relational database to store poker game data (like what would be included in the hand histories). I would like help figuring out how to design the associations. It seems like there should be 4 models: Game, Hand, Player, and Action (single action of a given player, like raise, fold, call). Let me lay out what I h...
I'm using Haml in rails and have been writting with the :markdown filter (bluecloth gem), but a piece of example code is in ruby and the page tries to execute the #{values}, how can I stop this?
Here is the breaking bit of code:
:markdown
like_frags = [fields].flatten.map { |f| "LOWER(#{f}) LIKE :word#{count}" }
or_frags << "(#{l...
I generated the default devise (http://github.com/plataformatec/devise) views with:
rails generate devise:views
Then I added a username field to the views/devise/registrations/new.html.erb form.
Currently, only email and password validation occurs. How do I validate presence and uniqueness of the username field? Do I need to add some...
I am trying to install the mogli gem( http://github.com/mmangino/mogli ) on rails 3 and am running into problems with the configuration. I have NO prior experience with Rails 2.
For Rails 2
Add config.gem "mogli" to environment.rb
For Rails 3, I added the following to the gemfile.
gem 'mogli'
For Rails 2, routes
map.resource :...