The main idea is that I have several worker instances of a Rails app, and then a main aggregate
I want to do something like this with the following pseudo pseudo-code
posts = Post.all.to_json( :include => { :comments => { :include => :blah } })
# send data to another, identical, exactly the same Rails app
# ...
# Fast forward to the s...
I have a rails app that uses freetds to establish an ODBC connection into a SQL Server Database. This app is on a server running under mongrel, in theory.
If I start the app with:
sudo mongrel_rails start -e development -p 9000 -d
I get
S1000 (0) [unixODBC][FreeTDS][SQL Server]Unable to connect to data source
However, when run w...
Hi guy,
I'm working to optimize my website in ror. The rails version is 2.3.5.
So, I log mysql query. And I see what rails use transaction (begin commit) to create or update object in database.
This method use my server resource and I would like to know how I can disable this commit ?
I don't find a configuration for this thing.
Thank...
I've got two models:
class Solution < ActiveRecord::Base
belongs_to :user
validates_attachment_presence :software
validates_presence_of :price, :language, :title
validates_uniqueness_of :software_file_name, :scope => :user_id
has_attached_file :software
end
class User < ActiveRecord::Base
acts_as_authentic
validates_pr...
On a rails project I am using the image_tag to generate my image html elements.
<%= image_tag("test.jpg", :alt => "test image") %>
is generating
<img src="test.jpg" alt="test image">
This is happening throughout my entire rails project.
Is there a setting somewhere that someone else set that is causing this?
How can I get rails ...
When I added search functionality to my first Rails app, I used Sphinx, after reading that using MySQL's built-in fulltext search was a bad idea. While Sphinx works well, it's a bit complicated to set up, and I feel there's too much overload for the simple searching functionality I require in my app.
Searches aren't performed very often...
I am dealing with a very simple RESTful Rails application. There is a User model and I need to update it. Rails coders like to do:
if @user.update_attributes(params[:user])
...
And from what I understand about REST, this URL request should work:
curl -d "first_name=tony&last_name=something2&v=1.0&_method=put" http://localhost:3000/...
I went through the railscast for the auto_complete plugin (here: http://railscasts.com/episodes/102-auto-complete-association), and got it working, even though I have a slightly different setup.
But here's the trouble: in the railscast, the example is a :belong_to association, and I have a has_many :through. I was using a collection_sel...
Where do I find documentation for what symbols are available (and what they do) for built-in Rails objects like ActionController? I'm on the ActionController::Base API page for rubyonrails.org, but don't see symbols information. I've tried querying Google, but I don't know what keywords to look for besides rails and symbols.
Anyone?
...
A widget has_one type, and type has_many widgets. I'd like to count which types are the most commonly assigned to my widgets (top 3 used).
What would be the best way to accomplish this?
The way I have the database structured is the widgets table has a type_id, which is assigned by a select when creating the widget.
I imagined that th...
For example, Test Table
|id|name |item_id|num|
|1 |apple |1 |1 |
|2 |orenge |2 |1 |
|3 |orenge |2 |1 |
|4 |pear |3 |1 |
|5 |apple |1 |1 |
.....
In Controller,
@items = Test.find(:all, :page=>{:size=>20, :current=>params[:page]})
I use paginating_find plugin.
In view,
<% @items.each do |item| %...
<%= f.label :name, 'Name' %> is causing the following error.
undefined method `extract_label_options!' for #
...
Hello all,
I'm playing with rails for the first time and running into errors with gems. If I enter the command, sudo ./gem install rmagick, I get the following:
Building native extensions. This could take a while...
Successfully installed rmagick-2.12.2
1 gem installed
Installing ri documentation for rmagick-2.12.2...
Installing RD...
I need some help with this, please ...
If I save a transaction status as a code in the db, but I want to translate them to meaningful names how do I do that? Is that even recommended? If no, what would be an alternative to that?
For example:
in the db the statuses are "S", "P", "A"
and in the actual application I'd like to display: "Su...
I am new to rails and using rails-2.3.5 and ruby-1.8.7. Here is my notifier.rb model:
# app/models/notifier.rb
class Notifier < ActionMailer::Base
default_url_options[:host] = "foo.com"
#This method sends an email with token to users who request a new password
def password_reset_instructions(user)
subject "Password ...
Imagine I have wiki Articles, with many Revisions. I'd like to do a query with ActiveRecord through the database, which only returns those Articles which have Revisions which are updated in the past 24 hours. Is such a thing possible?
I'd imagine it'd be something like:
Articles.find_all(:include => :revisions,
:co...
I’ve been trying to get the Nginx upload progress module running on WebFaction with Rails and Passenger (using Paperclip to upload to S3). The best result I have come up with so far are that it reports on start and on finish, but nothing in between. The Ajax request to the /progress path is working fine.
This is the nginx.conf file I h...
Basically, I want to fetch facebook profile avatars onto my application since I am using their login to create a particular record. How do we display their profile pic without actually forcing the user to connect into facebook to retrieve these pictures?
...
i have a transaction to ensure two models get saved at the same time.
begin
Recipe.transaction do
@recipe.save!
if @dish
@dish.save!
end
end
rescue
#save failed
flash[:notice] = "recipe.saved = #{@recipe.new_record?}"
render 'form'
else
#save worked
flash[:notice] = 'Recipe added.'
redirect_to(@recip...
I want to delete a gem I uploaded to GemCutter. I couldn't find any commands for this. Some time ago there was a blog post stating gem deletion as an upcoming feature. I haven't seen any further official announcements about this feature.
Please let me know if there is a way to do this.
...