Most of my migrations are by number, not timestamp, but 5 or 6 of them (the most recent) are with timestamp. These I want to move to number based, and now I want to forward the migration table to the appropriate number. How do I force the table to update without actually running the migration, or should I migrate down to 5 or 6 ago (befo...
I'm trying to manually build form fields for a testing purpose. I got the following models:
class Bedroom < ActiveRecord::Base
has_many :booked_bedrooms
has_many :bookings, :through => :booked_bedrooms
end
class Booking < ActiveRecord::Base
has_many :booked_bedrooms
has_many :bedrooms, :through => :booked_bedrooms
a...
So I have this div
<div id="result_text"></div>
And I try doing
render :update do |page|
page.replace_html :result_text, "<div style='font-size:medium;padding-top:25px;'>Thank you. A message has been sent to #{@object.user.name} with your comments.</div>"
I know the method is getting invoked. but the div doesn't get the new t...
When you execute an action on my application (only one action) the browser will just sit there not doing anything, when i check my production.log i see the request (about 2 minutes after i go to the address) but i see no errors or problems, while the browser never stops "Loading". I checked my NGINX server logs, and didn't find anything,...
I'm currently using attachment_fu to handle file uploads, and while the plugin provides a nice catchall for images in :content_type => [:image], nothing similar seems to exist for broader buckets. None of the uploads will be executed, per se, only saved to disk and served back at a later time. So a few related questions.
Is there any ...
Hi guys,
I'm having a problem with some associations in Rails3.
I have the following associations
InformationCategory :has_many => Informations :has_many => InformationValues
I'm able to succesfully do the following:
Information.first.information_values
=> [#InformationValue..]
I'm also able to do the following:
InformationCateg...
I can make a new , and that seems to work. But edit/update does not.
My controller :
def edit
@admin_wysi = AdminWysi.find(params[:id])
end
def update
@admin_wysi = AdminWysi.find(params[:id])
if @admin_wysi.update_attributes(params[:admin_wysis])
redirect_to admin_admin_wysis_path
end
end
And my HAML..
- form_for @adm...
I have done all this modification to setup monit and delayed_job.
I have create one file delayed_job.monitrc in my app/current/config.
delayed_job.monitrc
check process delayed_job
with pidfile /home/sysadmin/app/current/shared/pids/delayed_job.pid
start program = "/usr/bin/env RAILS_ENV=production /home/sysadmin/app/current/scrip...
I'm building a wiki system for an application. The essence of the design is that there is an Article model, and each Article has_many Revisions. When it's time to display an Article, the most recent Revision is pulled up to get all relevant information.
This seems like a perfect case to use an accepts_nested_attributes_for so that editi...
In many places on many of my sites, users are permitted to enter formatted text through a WYSIWYG or through plain text with tags. Naturally, such input is sanitized for security threats, but it is not stripped of tags nor is it fully entity encoded. Something like <p>hello world</p> ends up going back to the end user as <p>hello world</...
In Rails 3, how do you change the default primary key type to, say, BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY
In my case I'm only interested in MySQL.
For Rails 2, you can see the answer to "How do I use long IDs in Rails?"1
In Rails 3, however, this will throw an error. I'm not sure if that's because the class is no long u...
class Exercise < ActiveRecord::Base
belongs_to :user
end
class User < ActiveRecord::Base
has_many :exercises
end
Why can't I find all Exercises there were created by users with the role of "admin"?
Exercise.first :include => [:user], :conditions => ['user.role = "admin"']
The error shoes that the users table is not being join...
I'm trying to send a streaming response in a Rails application, specifically using the multipart/x-mixed-replace content type. As far as I can tell, streaming responses are not supported by Rails since the container tries to buffer and determine the length of the response body before sending anything to the client.
Incidentally, we are...
If i allready have a photo in my filesystem how can i save it without submitting a form? I would like to do that in a controller when some action occurs.
I am using paperclip to save my photos. so if you have any idea how to make paperclip save it it would also be very helpful.
Paperclip:
I allready have a photo saved with paperclip. ...
I want to write a method that simplifies the names of corporations. I would like it to work as follows:
@clear_company = clear_company(@company.name)
What would happen is @company.name = "Company, Inc." @clear_company would be "Company"
If @company.name = "Company Corporation" @clear_company would be "Company"
There wouldn't be ex...
Im trying to submit a form with a tinyMCE textarea. Im submitting the form via javascript, and in order to do this i know you have to call tinyMCE.triggerSave to copy the contents of the editor to the hidden textarea it replaces. For the life of me i can NOT get tinyMCE.triggerSave to do ANYTHING. I know its not because i run the command...
Reason why I want to run them individually, is because I need to have them individually set up in my rake file, because, My Java Heap Space fills up when I run them all together
...
hi
i have a rails app that currently uses activerecord to store and query products.
Each product has a category and sub category and each sub category is defined by multiple field that i can create within the application. From this when a user wants to input a specific product, they are pressented with the relevent form fields.
This ...
You would think I would get this done in 10 seconds, but I've spent 1/2 hour and am getting nowhere..Here is what I have/want:
<table>
<% i=0 %>
<% for name in @names%>
<% i++ %>
<tr>
<td><%= "#{i}" %></td>
<td><%= name.first %>"></td>
</tr>
</table>
Yes, all I want is a numbered list of names, l...
I am getting bad performance after upgrading an application to Rails 3.
Before upgrading, I got 60ms - 100ms response times.
After upgrading, I get 300ms - 1500ms response times.
The log shows a sample response time from each time:
Rails 3.0.0: Completed 200 OK in 1454ms (Views:
1314.6ms | ActiveRecord: 25.1ms)
Rails 2.3.8: ...