First, I'm a complete newb to rails - I've been trying to get my feet wet, but ran into some trouble here.
I've followed http://kb.mediatemple.net/questions/279/Ruby+on+Rails+using+Mongrel+Clusters to install rails, everything worked except one of the last steps:
"cp /var/www/vhosts/testapp.mt-example.com/rails/testapp/public/.htaccess...
Hi, I've been trying to implement a dynamic multi-model form with accepts_nested_attributes_for in my rails application. I've been following Eloy Duran's complex-forms example that shows a 2 level implementation, but I've been trying to expand this to 3 levels. Is there support with accepts_nested_attributes_for for a 3 level form? Ca...
Hi all.
I have strange globalize2 problem. I'm trying to use globalize 2 and acts_as_textiled and acts_as_commentable. For example - lets we have Post model, that acts_as_commentable. From console
p = Post.find 1
c = p.comments.find 1
works fine, but in browser - nothing displayed
Similar, when Post contains
acts_as_textiled :body
...
I'm developing a plugin for Redmine.
How do I create a migration for it?
If I use script/generate plugin_migration, it'll be placed in /db/migrate folder, but I need it to be in my plugin's folder.
...
This is a snippet of code from an update method in my application. The method is POSTed an array of user id's in params[:assigned_ users_ list_ id]
The idea is to synchronise the DB associations entries with the ones that were just submitted, by removing the right ones (those that exist in the DB but not the list) and adding the right o...
As my Rails app matures, it's becoming increasingly apparent that it has a strong data warehouse flavour, lacking only a facts table to make everything explicit.
On top of that, I just read Chapters 2 (Designing Beautiful APIs) and 3 (Mastering the Dynamic Toolkit) of Ruby Best Practices.
Now I'm trying to figure out how best to design...
My application has news, posts, comments and various other common things. I'd like to be able to keep track of what a user has viewed so that they can be greeted with "4 new Posts" and that type of thing.
At the moment I'm just reporting the number of 'New Posts' with something like:
Post.find(:all, :conditions => [ "updated_at > ?", s...
I have a view like this,
<% count = 1 %>
<% for voting in @voting %>
<% if voting.question_id.eql?(count) %>
<%= radio_button( count, voting.vote_count, :radio_id => voting.nominees ) %>
<%= voting.nominees %>
<% end %>
<% if voting.nominees.eql?(radio_id) %>
<% voting.update_attribute('vote_count...
I have 4 related migrations in my Rails app:
First 3 migrations create one table each in the self.up and and drops them in their respective self.down methods.
4th migration runs a rake task that loads data to all three (in self.up). I am thinking what to put in self.down of this migration to delete the rows from the 3 tables?
Am I doi...
How is it possible that the model validation errors messages are getting duplicated in ruby on rails application?
...
So I deduced from Rack documentation, but maybe I am wrong...
...
I use Rails for building a web application.
I want to create a list of records and display this list using ExtJS and its Grid module.
What is the best way to pass my data from Rails to ExtJS?
It would be nice, if the ExtJS code gets rendered while rendering the html, so no AJAX-calls are needed.
Best regards
...
Say I have a User model with the following code in User.rb:
before_create :create_dependencies
after_create :build_inbox
And I also have a users.yml file with a bunch of user fixtures defined in it.
When I run rake db:fixtures:load, it doesn't appear to trigger the callbacks.
Is this how it is expected to work? If so, why did they...
I need to cache (and expire) all the models in a table.
For example, if i have a model named Currency, i only have less than 10 possible currencies. Therefore, it would be nice to have:
class Currency < ActiveRecord::Base
cache_all(:expire_in => 10.minutes)
end
so that
Currency.all
Currency.find_by_name("USD")
should not hit the...
How can I dynamically configure a validation in rails?
For EXAMPLE if I have
validates_length_of :name, within => dynamic
The variable "dynamic" will be set by the user. On save, the validation should use the value of the variable "dynamic" to configure the within configuration.
...
Is there an equivalent ruby/RoR method for PHP get_meta_tags.
I am looking to read the meta tag information of a given url
...
As of Rails 2.3, what's the right way to add a directory to the load path so that it hooks into Rails' auto-reloading mechanisms?
The specific example I'm thinking of is I have a class that has several sub-classes using STI and I thought it would be a good idea to put them in a sub-directory rather than clutter the top-level. So I woul...
There seems to be no shortage of questions out there about this, but it's a little more difficult to find solid answers that aren't woefully out of date. I'm taking my first (baby) steps with Rails (and Ruby, for that matter) and I'd really like to use UUIDs as my primary key. In fact, for most of my projects, it's all but essential sinc...
I'm trying to find the count of the number of devices that are greater than the amount from a certain data source.
last_data_source = LocalDeviceSummary.find(:first, :order => 'created_at desc')
count = RemoteDeviceSummary.count ["DeviceSummaryIndex > ?", last_data_source.data_source_id]
The last_data_source works fine, I tested that....
Today, for no reason, my rails(2.1.0) application is very slow or even not responding.
It happens intermittently.
So sometimes it works but again it doesn't work.
When it doesn't work, I can't even load 'script/console production'.
I want to know where it's stuck.
How do I load console step-by-step so that I can know which part causes t...