I have a Rail3 app with paper_clip, with the intent to store data on S3.
In the app, Users belong to an instance.
I would like the data stored across all the models per instance. And would like to prevent a user for Instance A from accessing, or being able to load data from Instance B.
What's the best way to handle this? thanks
...
I have a relatively simple site on my hands, and have for nearly a year, but I can't seem to find a platform to build it on that doesn't fight back at the way I want to do things. Here are the key features:
Customizable profiles. Profile tags.
Two primary content types: Haves & Wants
Both content types searchable/taggable and expire wi...
Hopefully I can be clear on my issue. If you need more clarification on what I mean, please let me know and I'll try to clear up anything I can.
I am currently working on a simple Ruby on Rails project and I want to add some interactivity to my login form. Currently, the login form works fine if you click the Login link which then take...
I am following Ryan Bates' railscast on Sortable Table Columns and I have successfully gotten a column to sort ascending and descending.
My table is more complex than in the Railscast because I have columns from different tables.
# controller
@cars = Car.find(:all).order(sort_column + " " + sort_direction).includes(:manufacturers)
#v...
I have an Article which has_many Comments.
When i create comments i can use "new" to build them in memory, and the comment records only get created when the article is saved.
Does such a mechanism exist for marking comments for deletion, so that their records are only removed when the article is saved?
thanks.
...
Hi there,
I have two models and controllers:
Snippets, and Tags.
There is a belongs_to relationship, with tags belonging to snippets. This works well, I have a text field which creates a new tag associated with the snippet when the user submits a snippet.
I want to be able to have a text field which, when submitted to a function (in t...
I've been upgrading my app from Rails 2.3.8 to Rails 3.
After getting all the basic stuff done (configs, routes, and the new AR API, replacing Authlogic with Devise) and getting some mostly static pages to show up fine I get an error in the rest of my site:
You have a nil object when you didn't expect it!
You might have expected an ins...
I currently have gitosis installed and configured on a server. It does exactly what it says on the tin, and does it well.
One of the repositories is a Rails application, an application which is ran in production mode inside a subdomain (lets call this staging.foo.com) before going live. The contents of this Rails application is located ...
Hi,
My rails 2.3.9 app won't start, this is what happens:
C:\Devel\immonatie>ruby script/server
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load --
script/../config/boot (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from script/server:2:in `<main>'
The app was work...
It seems that most of Rails 3, Ruby 1.9.2 can be used, but when it is sqlite3-ruby, or mysql2 gems, then it can't compile, (missing mkmf?) and the latest Xcode is needed. But the latest Xcode is for Snow Leopard only. So looks like the Macbook needs to be upgraded to Snow Leopard before Rails 3 can be used?
...
First attempt at a RoR project and following http://guides.rubyonrails.org/getting_started.html#creating-the-blog-application .
I've got the "Welcome Aboard" page serving.
Within the section 4.2 Say "Hello", Rails the tutorial says to issue the command :
$rails generate controller home index
... and that that will create a file
...
I am using ActiveMerchant to give my rails app access to Paypal's Express Checkout.
I would like to include the Order Details on the Review Page as described here: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECCustomizing
Can this be done?
Currently, my controller code looks like this:
d...
I'm sure there's an easy solution for this but I'm new to Rails and need help with syntax.
In my controller I have:
@products = Product.all
format.json { render :json => @products }
And it works fine, returning data with the default column names used in the DB:
"product": {
"created_at": "2010-10-08T17:24:27Z",
"id": 24,
"prod...
I have a Note model, with a note_type field. How do write a migration that will remove Note records from the database if the type is "short_note"?
...
Hi all,
I'm parsing an XML file with a few thousand elements in it for insertion into a sql database. Everything works fine with sqlite, but postgres dies on me with this error:
PGError: ERROR: out of shared memory
I was monitoring locks, and it looks like there's a lock for each insert statement, and although I'm just looping over...
G'day guys,
Currently having a bit of a philsophical conundrum. Myself and a few mates have built a quite awesome ruby CLI script for parsing and managing data. It uses gems, responds to requests and is fully functional and great.
I was wondering if there was any way I could hold a singleton instance of this class and interact with it...
Give a model.created_at
I've been able to use:
<%="#{time_ago_in_words(model.created_at)} ago "%>
What is the helper to output something like
Oct 8
Sep 23
Aug 31
Jul 11
Bonus points, if it outputs like above, but for any records that were created today (not 24hrs ago but today). it shows the time, example:
4:31pm
1:20pm
9:31am...
How can I tell if a column in my sqlite3 database has a database index on it?
...
I am working on populating my database with test data using populate.rake:
Repertoire.includes(:jokes).each do |r|
@jokes = r.jokes
Skit.populate 8..12 do |skit|
skit.joke_id = @jokes[rand(@jokes.count)].id
end
end
This is giving me a RuntimeError: Called id for nil.
How can I populate a skit with random jokes?
...
I have quite a few fields, in a few different models, upon which I perform searches using Model.find_by_xxx
Should I be adding a database index for every field I use find on?
...