For the purposes of the discussion I cooked up a test with two tables:
:stones and :bowls (both created with just timestamps - trivial)
create_table :bowls_stones, :id => false do |t|
t.integer :bowl_id, :null => false
t.integer :stone_id, :null => false
end
The models are pretty self-explanatory, and basic, but here they are:
...
I have two models, associated with a HABTM (actually using has_many :through on both ends, along with a join table). I need to retrieve all ModelAs that is associated with BOTH of two ModelBs. I do NOT want all ModelAs for ModelB_1 concatenated with all ModelAs for ModelB_2. I literally want all ModelAs that are associated with BOTH Mode...
Hello,
I have always been taught that storing objects in a session was a bad idea. Instead IDs should be stored that retrieve the record when needed.
However, I have an application that I wonder is an exception to this rule. I'm building a flashcard application, and the words being quizzed are in a table in the database whose schema ...
Hi All,
I'm having a bit of a domain/scope issue when it comes to some plugins. Basically I'm using the OFC2 (http://pullmonkey.com/projects/open_flash_chart2/) for rails. However, I already have a class in use called Charts. I tried prepending a lot of my existing calls to Chart with "ActiveRecord::" but I'm not comfortable with thi...
I am using the acts as taggable on steroids plugin and my web app has 4 models:
Category
Entry - acts as taggable and contains the following using single table inheritance
Story
Topic
Category has two important fields:
tags:string - A list of tags associated with this category
primary_tag:string - A single tag that gets assigned ...
I am working on a content management application in which the data being stored on the database is extremely generic. In this particular instance a container has many resources and those resources map to some kind of digital asset, whether that be a picture, a movie, an uploaded file or even plain text.
I have been arguing with a colle...
I've set up a new Rails 2.3.2 app and added the Basecamp API ruby wrapper to my /lib directory from here:
http://developer.37signals.com/basecamp/basecamp.rb
In my application_controller.rb I have created the following method to enable calls to Basecamp:
def basecamp_connect
Basecamp.establish_connection!('xxxxxx', 'xxxxxx', 'xxxxx...
I'm writing my first rails plugin and could use a little help. In a very simplified way, I'd like to do allow the developer to specify a value which I can count through a rake task. I'm thinking of something like this...
class User < ActiveRecord::Base
monitor "Users", count
monitor "Active Users", count("activated_at != NULL")...
I have just optimised some Ruby code that was in a controller method, replacing it with a direct database query. The replacement appears to work and is much faster. Thing is, I've no idea how Rails managed to figure out the correct query to use!
The purpose of the query is to work out tag counts for Place models within a certain distan...
I have the following models:
class Person < ActiveRecord::Base
has_many :accounts, :through => :account_holders
has_many :account_holders
end
class AccountHolder < ActiveRecord::Base
belongs_to :account
belongs_to :people
end
class Account < ActiveRecord::Base
has_many :people, :through => :account_holders
has_many :acco...
Anybody have any ideas? The situation is like this: I have a primary rails app and an auxiliary one. The auxiliary app is used to transform a web service request into a RESTful PUT to the main app. The resource the auxiliary app is attempting to add to requires authentication. Any ideas would be much appreciated! Thanks SO!
...
Every time I want to run Rake test the task db:test:prepare is being called and it rebuilds my test environment database from schema.rb and migrations. What I would like to achive is to disable the call of db:test:prepare when I want to test make Rails application. Is it possible without modifying Rails gem?
...
I've been wanting to make the switch from PHP. Anyone care to highlight the similar classes or the key differences between CakePHP and Ruby on Rails?
Thank you!
...
I want to get a xml file, which I can request by an http request into an object.
I'm looking for something similar to this (in a controller):
@ticket = request "http://example.com?ticketid=1234"
http://tickets.com?ticketid=1234 returns an XML (tickets.com is not the site the app is running on).
I then want to parse @ticket, to get th...
I have a local variable in an erb template:
<% thumbnail_width = 50 %>
I'm using this for sizing some thumbnail images.
But now I realize that a number of templates will need to access this variable.
Where should I move it to and what type of variable should it be?
...
We are writing a Rails application that is using CouchDB as its data store. We're BDD/TDD'ing with RSpec and Cucumber, which is using WebRat for webpage testing
I'm trying to remove ActiveRecord as one of the resources that is being loaded by rails but its causing the cucumber tests to fail. I've removed all references that I can find...
Python and Ruby are usually considered to be close cousins (though with quite different historical baggage) with similar expressiveness and power. But some have argued that the immense success of the Rails framework really has a great deal to do with the language it is built on: Ruby itself. So why would Ruby be more suitable for such a ...
I have a Cucumber step for my Rails application:
Then /^I should be redirected to the sign in page$/ do
assert_equal 302, @response.status
end
But that @response object is the one returned by my Controller, and it's the Rack middleware that sets the status to what I expect it to be. How can I get at the response as returned from th...
Long introduction:
Normally all data necessary for my web application are stored in session variables. Only if the user explicitly says that something is to be saved, it is stored into the database. (Like saving a comment or creating an order from a shopping cart)
In my latest Rails application I noticed that I really could use many of...
How can i customize the file field "Browse" button in ruby on rails. cutomise in sense i want to change the button color and style. Is this possible in ROR? If so , can any one help me out ....
...