Hi guys,
I'm experiencing a few errors on a rails app, along the lines of:
ActiveRecord::StatementInvalid: Mysql::Error: Lost connection to MySQL server during query: SELECT * FROM `actions` WHERE (`foo`.`id` = 16)
What appears to be happening is that mysql connection is being closed after a timeout, and rails isn't noticing until i...
I want to preface this question by stating that I am fairly new to Ruby development, however, personally, I've dedicated myself to trying to find the answers myself, as opposed to whimsically asking questions on forums. That being said, this is my first official "post", and I have made every attempt to be as accurate and concise in my po...
I'm using paperclip for uploading files, handling images is easy, but how can I handle images (png, jpg) and swf in the same upload, even pdf files, when I have to create different styles of the images but not the other formats.
...
My app is in development and I do all my testing using WEBrick (I like the terminal output).
On the production server it will run on Phusion Passenger.
I'm running Snow Leopard and wish to test the app in an environment similar to the production environment.
Can I use Parallels to run a Debian install with Apache and Passenger and con...
One of the components I need for an application I am working on is very similar to a CMS. Whereas I allow a user to write their own HTML.
The concept consists of custom tags and blocks.
For example. What i need to do is combine the following at runtime.
<div id="products">
<module type="products" display="5" />
</div>
<!-- then a b...
I have heard over and over that you should add indexes to any foreign key you will be doing joins on. I have also heard you should have indexes for fields you will do queries on. Does anyone have a fairly exhaustive list or set of guidelines around when and when not to add indexes?
There must be a size of table where it is inefficie...
I have a data structure that is basically a tree using :wesome nested set:
class category
acts_as_nested_set
What I want to achieve are routes like
/categories/1/children/
/categories/1/children/new
I know I could fake it by making a separate controller, but it seems a bit non-DRY. Are there any better ways to do this?
...
I have the following in a view (.html.erb) :
<% @posts = GetAllPostsFunctions %> (removed for berivity)
<% @posts.each do |post| %>
<%= post.title %>
<%= render :partial => "posts/post_show" %>
<% end %>
the posts_show partial has the following:
....
<td><%=h @post.title %> </td>
But I get the following error
You have a nil o...
Is there a way to disable the default_scope for a single belongs_to association? The default_scope is fine for all but a single belongs_to that I would like to bypass the scope. I'm familiar with with_exclusive_scope however I don't think that can be used with belongs_to.
Any suggestions?
Context: I'm trying to allow the branch_source ...
I currently have a nested forms model. The nested forms for the paperclip attachments work fi and don't populate the DB with blanks, but another one I have for quotes always saves one blank quote along with my main model when I create a new one. How can I just have it silently fail and bypass writing this to the db? It's an optional fiel...
This feels like it should be pretty simple, but not much seems to be loading.
I have this in my app/views/layouts/application.html.haml:
= javascript_include_tag 'http://www.google.com/jsapi'
%script{ :type => "text/javascript", :charset => "utf-8" }
//<![CDATA[
google.load("jquery", "1.3.2");
google.load("jqueryui", "1.7.2");
...
I want to create an administration option to create text boxes, combo boxes and other stuff that I'm going to give as an option. and make a database for it on-the-fly. I don't know if that make any sense at all. Something like this
type: int, string ( <- in a combo box
), name: ( <- text field to input the
name of the option) |ad...
Just as on StackOverflow, in my app a User can write Questions and can also provide Answers:
class User < ActiveRecord::Base
has_many :questions
has_many :answers
end
class Question < ActiveRecord::Base
has_many :answers
belongs_to :user
end
class Answer < ActiveRecord::Base
belongs_to :question
belongs_to :user
end
My ...
I'm using link_to_remote to update a partial on my page. The problem is that Rails isn't finding my partial.
I am specifying the full path to my partial(an html.erb file) in the controller method:
def my_method
create something
render :partial => '/shared/partials/my_partial_form', :layout => 'false'
end
I know the controller met...
What's the best plugin for simulating a dropbox that goes direct to S3 for a Rails model. Ideally, it's almost be like a desktop folder than one can add files into, delete, etc.
...
Hello,
I want to add search functionality to my Rails website. The search has to rank results according to relevancy. By this I mean if the search occurs in the post title it should be given higher score than post body and post comments. Also, it would be nice to rank a post higher if the phrase occurred more than once. I know that Sphi...
I am learning and liking cucumber, and now have a feature I'm not sure of the best way to proceed on via BDD: pagination. I have scenarios (in my mind) where there are zero pages, one page, several pages, etc. and where I want to make sure certain records are on certain pages, make sure the "next" button is not a link when on the last pa...
I have to built a social networking site on Ruby on Rails. The features in the site may change from time to time; so we will need to add/remove features with ease. Moreover, we may be building another social networking site. Due to these reasons, we are thinking to build a basic framework for social networking sites in RoR with the featu...
I have a Rails App in which I have hundreds of model that only have CRUD operations. I could use scaffold/active scaffold but then I end up having so many files in my application directory.
Is it possible to do something like have a generic model, view and controller to handle these rather than having 500 of them in the application fol...
Hey folks,
I have a database table with a certain field which should be impossible to update once it has been inserted to the database. How do I tell my model that it shouldn't allow updating of a certain field?
Best Regards,
x3ro
...