i have a link_to_function that shows a hidden div. now i would like to hide this div if the user clicks out of this div(onBlur or onclick). when should i call this function and how? this is my function that shows the hidden div:
<%= link_to_function "ShowHorse", "$('horsePic').show();" :class =>"links_02"%>
shoud it be from inside thi...
I'm looking for recommendations for a Wiki that can be deployed on Heroku.
...
I finally have my application written, and now I have a request to store the logs into a mysql db for later searching. Any ideas besides log4r?
Thanks!
Tonya
...
I have a Rails app where people have a profile page - http://prettylongdomainname.com/profile_username
To create the profile username, I use a before_create AR hook in my model:
before_create :generate_username
def generate_username
self.username = a_user_name_i_generated
end
I would also like to save a shortened URL to the user...
Hi everybody,
I have one model, which I save changes witch happens to certain person. I want to get now the latest state of all person.
so I need to:
- order: created_at asc.
- find_all: limit: one change each person
how can I accomplish that?
Thanks,
Markus
...
I reinstalled mysql5-server through MacPorts and suddenly my migrations started running a lot slower. rake db:migrate:reset used to take less than a second before. It takes 33s now. When I run it on a Linux machine (or even another Mac), it takes less than a second again. I remember encountering this problem in the past, but I don't reca...
Hi, for a forum-like application I need the ability to show each user the unread (new) messages. Is there any Rails plugin/gem for that purpose?
Or: Are there any hints to do this job in a efficent way? I'm thinking about an additional database-table storing the unread-status (or read-status?) of every message for every user. But this ...
Hi,
I have strange situation - when I'm trying to update model, that can contains attachment by Paperclip (I'm using postgres as db) with the following code I see errors:
>> u.profile.avatar = nil
=> nil
>> u.save!
ActiveRecord::RecordInvalid: Avatar file size file size must be between 0 and 1048576 bytes.
from /opt/local/lib/r...
I have in Rails application several tables with foreign keys constraints. For example, every order belongs to a customer. There's a costumer_id column on the orders table.
When I delete a costumer with a placed order, because of database constraints, MySQL returns the error:
Mysql::Error: Cannot delete or update
a parent row: a fo...
I've got a user model which contains a field called, lets say, text1. In the users/new form I want to have 4 individual text boxes for this text1. In my model I will take values from these boxes and concatenate them together as comma separated values and store them in the DB. To give you an understanding, this is what I want.
<input typ...
Say my user is viewing messages/index, and someone else sends him a message. I'd like the user's view to update in real-time to reflect the new message, kind of like how Twitter lets me know there are more messages on my timeline. Are there any examples of this being done in Rails?
...
I have a Rails app which has a table called friendrequests. It looks like this:
user1_id:integer user2_id:integer hasaccepted:boolean
I'm creating an option to add friends, but a friendrequest can only be send once. So you cannot have something like this in the database's data:
user1_id | user2_id | hasaccepted
1 | 2 | ...
Let's say I have a blog application. On each Post there are Comments.
So, I have a collection of comments in "Post.comments"
Let's say I have an object called "this_comment"
Is there a magical keyword or construct in Ruby such that I can test "is 'this_comment' in 'Post.comments"?
In other words, I want to know if "this_comment" is a...
Routes in Ruby on Rails are case sensitive. It seems someone brought this up before, and it has been labeled will not fix.
http://rails.lighthouseapp.com/projects/8994/tickets/393-routes-are-case-sensitive
That strikes me as unfortunate, as I don't really see any upside on my own application for routes to be case sensitive, while on th...
Hi,
link_to_function raise an error with rails 3.
undefined method `link_to_function' for #<Class>
How can i do to have a link with a simple onclick, with the new rails 3 syntax?
Thanks
...
Hi all,
I have a model that relies on state_machine to manage its different states. One particular event requires a before_transition as it needs to build a join table fore doing the transition. Unfortunately it doesn't work.
class DocumentSet < ActiveRecord::Base
state_machine :state, :initial => :draft do
# Callbacks
befor...
Is there a pattern or a gem (Ruby on rails) for modeling the wiki-like behaviour of a StackOverflow like web site?
I'm working on Ruby-on-Rails project so a gem or something in RoR would be appreciated but a well defined pattern is just as good.
Thanks
...
I have an array like this
a = []
a << B.new(:name => "c")
a << B.new(:name => "s")
a << B.new(:name => "e")
a << B.new(:name => "t")
How i can save it at once?
...
I spent all my time yesterday trying to get ANY Rails tagging plugin to work. While installation was straightforward, I have to say the amount of documentation on how to use any of these plugins was dismal at best...
For the record, I tried:
is_taggable
acts_as_taggable_on
acts_as_taggable_on_steroids
acts_as_taggable_redux
In every i...
Normally, when using form helpers in Rails, each field directly correlates to a method on the appropriate object.
However, I have a form (user signup) that needs to include fields that are not part of the user model itself (for instance, card details) but need to appear.
How can I build the form so that I can get the necessary fields, ...