I would like to use formtastic to create form but I don't have a model associated with that (login form with username, password and openid URL).
Of course I could create a model to do that but that model was just a hack without any useful code in it.
...
Hi I have a strange situation here:
# Is there a semantic difference between these 2 in ruby?
class MyClass < ClassThatExtendsActiveRecordBase
...
# code snippet A:
def image_width(size); self.image.width(size); end
# vs code snippet B
def image_width(size)
self.image.width(size)
end
end
I have a situation where code...
I have a view with the flexigrid component on it. When the view calls the mickey_mouses_controller#new action, the flexigrid component calls mickey_mouses_controller#grid_data action (via localhost:3000/mickey_mouse/grid_data) and returns the relevant json objects correctly.
However, when I submit my view so the ActiveRecord validations...
Im trying to make a system that informs the user of any new private messages, the index method of the messages controller creates to instance variables of @messages and @newmessages, both are used in index.html.erb and i want to make it so that index.js.erb makes the flash message box on my site appear.
Ive got jquery to run a function ...
I'm using periodic_remote_call and it updates a div with pictures.
How Can I get these pictures to be preloaded?
...
Hello
I'm trying to create a BBcode [code] tag for my rails forum, and I have a problem with the expression:
param_string.gsub!( /\[code\](.*?)\[\/code\]/im, '<pre>\1</pre>' )
How do I get what the regex match returns (the text inbetween the [code][/code] tags), and escape all the html and some other characters in it?
I've tried thi...
I wrongly named one column as hased_password, should have been hashed_password instead.
Can i use migration to correct it?
...
I have a "category" table that contains different kind of "product", so I create this in the category.rb:
class Category < ActiveRecord::Base
has_many :products
end
And this in product.rb:
class Product < ActiveRecord::Base
belongs_to :categories
end
I would like to know how can I get the :categories From the product in the pro...
The same question has been asked many times, but I am unable to find a solution that works for me.
I have three models, posts, users, and picture (paperclip).
I use restful_authentication and set it up so that each user sees only his/her post in posts/index. I've also given him the ability to upload a profile picture.
My question is h...
I have vanilla Mac OS X Leopard which comes with 1.8.6.
I am new to RoR so will be following tutorials on the net. Am I likely to find problems following them when using later versions of Ruby?
I am currently looking at this one which mentions 1.8.6 and 1.8.7 - http://www.railstutorial.org/book
...
What's the best way to override validation messages for login/password in the Session model in Authlogic? In the User model Authlogic provides the merge_ methods to override validation options, but Session does not have anything like that.
Any suggestions?
...
Complete rails newbie trying to get started.
I have two classes, Ingredient, and Unit. There are three units, lbs, gallons, and dozens, and each ingredient has exactly one unit. I think I got the associations/routes set up correctly.
When creating a new ingredient, I need to require the user to set the units from these three.
I used a...
Users on my site create annotations for rap lyrics (example). I want to create a leaderboard to reward the people who create the most annotations.
The leaderboard should track how many annotations each user has created overall, as well as how many he has created in the past week, day, etc.
I have no problem implementing the overall lea...
Hello,
I have a posts model which has_one reposts and has_one sponsored. User can purchase reposts and sponsored posts while creating a post. I want that the minimum purchase(sum of reposts and sponsored purchases) be atleast 1$. so i want to validate this in the post model but i can't figure out on how to write such ...
I'm using MongoDB as a backend for a Rails app I'm building. Mongo, by default, generates 24-character hexadecimal ids for its records to make sharding easier, so my URLs wind up looking like:
example.com/companies/4b3fc1400de0690bf2000001/employees/4b3ea6e30de0691552000001
Which is not very pretty. I'd like to stick to the Rails url ...
I'm having a weird problem. I do a deploy and then the dir that just got uploaded is then deleted by the cleanup task. I haven't deployed to this site in well over a month but I didn't change the deploy recipe. Any ideas?
Here's the output. http://gist.github.com/267850
...
Another newbie question.
The goal: each ingredient can have zero or more unit conversions tied to it. I want to put a link to creating a new unit conversion on the page that shows a specific ingredient. I can't quite get it to work.
Ingredient Model:
class Ingredient < ActiveRecord::Base
belongs_to :unit
has_many :unit_conversi...
I am getting this error when deploying with capistrano:
executing "cd /opt/my_app/dev/releases/20100103021722; rake RAILS_ENV=staging db:migrate"
servers: ["96.30.33.84"]
[96.30.33.84] executing command
** [out :: 96.30.33.84] rake aborted!
** [out :: 96.30.33.84]
** [out :: 96.30.33.84] No Rakefile found (looking for: rake...
I am getting the following error:
TypeError: Error #1034: Type Coercion failed: cannot convert "2010-01-02 23:28:17 UTC" to Date.
I am using WebORB to transfer data between Rails and Flex. The data coming from Rails is of type: 'ActiveSupport::TimeWithZone'. I am trying to assign it to a Flex 'Date' data type.
What am I missing?
...
Hi,
I have an object called Review which :belongs_to two objects: Users and Vendors. In other words, there is always a vendor writing a review for a specific vendor.
When I create a review, I tried to use the .build method to presumably add the foreign_key at the time the new record is created for review.vendor_id and review.user_id.
...