Hello all,
I'm working with a rails app which plays mp3s. Is there a way to catch the request for the mp3 file with ruby, reformat the request(url), and pass the request along?
Hello, i am currently trying to learn RubyOnRails as i am a long-time PHP developer so i am building my own community like page.
I have came pritty far and have made the user models and suchs using MySQL.
But then i heard of MongoDB and looked in to it a little bit more and i find it kinda nice.
So i have set it up and i am using mongomapper for the connection between rails and MongoDB.
And i am now using it for the News page on the site.
I also have a profile page for every User which includes their own guestbook so other users can come to their profile and write a little message to them.
My thought now is to change the User models from using MySQL to start using MongoDB.
I can start by showing how the models for each User is set up.
The user model:
class User < ActiveRecord::Base
has_one :guestbook, :class_name => "User::Guestbook"
The Guestbook model model:
class User::Guestbook < ActiveRecord::Base
belongs_to :user
has_many :posts, :class_name => "User::Guestbook::Posts", :foreign_key => "user_id"
And then the Guestbook posts model:
class User::Guestbook::Posts < ActiveRecord::Base
belongs_to :guestbook, :class_name => "User::Guestbook"
I have divided it like this for my own convenience but now when i am going to try to migrate to MongoDB i dont know how to make the tables.
I would like to have one table for each user and in that table a "column" for all the guestbook entries since MongoDB can have a EmbeddedDocument. I would like to do this so i just have one Table for each user and not like now when i have three tables just to be able to have a guestbook.
So my thought is to have it like this:
The user model:
class User
include MongoMapper::Document
one :guestbook, :class_name => "User::Guestbook"
The Guestbook model model:
class User::Guestbook
include MongoMapper::EmbeddedDocument
belongs_to :user
many :posts, :class_name => "User::Guestbook::Posts", :foreign_key => "user_id"
And then the Guestbook posts model:
class User::Guestbook::Posts
include MongoMapper::EmbeddedDocument
belongs_to :guestbook, :class_name => "User::Guestbook"
But then i can think of one problem.. That when i just want to fetch the user information like a nickname and a birthdate then it will have to fetch all the users guestbook posts. And if each user has like a thousand posts in the guestbook it will get really much to fetch for the system. Or am i wrong?
Do you think i should do it any other way?
Thanks in advance and sorry if i am hard to understand but i am not so educated in the english language :)
Does anyone know of a good guide on building your own authentication system in rubyon rails?
I want to roll my own system to use with my community im building :)
Thanks!
I want to know if the mysqlplus gem is a better database driver than the common Ruby mysql gem? I used to have some problems in my Rails application, like:
ActiveRecord::StatementInvalid: Mysql::Error: MySQL server has gone away
Hi,
I am receiving http requests to my rails application to a url /account/postback
The body of this incoming request contains some json that I need to retrieve, how can I do this in ruby?
Thanks,
Andy
I am developing a my application onrails.It has 400 or more models.
And some model contains more than 200 rows just for relationships.
so it's too hard handle it.
Is there any ways i can handle my application more proper and easy ways.
I love to use Textmate on my Mac at home but have a hard finding somehing to use at work (windows).
What is the best editor to use for RubyonRailson windows that get you the closest look and feel to Textmate?
Hello,
I know that question with same title has been asked almost 6 month ago.
I have Googled for this problem and I have not found any working solution.
Has there been any fixes for this very critical problem?
I need to get my website running ASAP. Just to get the site up and running I'm even ready to add utf8 conversion methods to all my variables or risk to upgrade to Rails 3 beta
Thank You in advance!
I'm using RSS library so i can parse Atom and RSS in Ruby and Rails and store it in a model.
I've looked at the standard RSS library, but is there one library that will auto-detect that there is a new rss feed so i can update my database ?
what are the best practice to trigger an instruction in order to store the new rss feed ?
should i use threads to handle that problem ?is it going to be slow?
thank you for your help
Whenever I use 'n' to step over a line it steps into it instead. This happens to me on all the versions of jruby i've tried, the latest being 1.3.1
Does it work right for anyone? If so any idea how to fix it, because it's too painful when it steps into every function every time.
Also, I use it like this if it makes any difference.
require 'ruby-debug'; debugger
Hi guys, I am trying to devise a set of 15 to 25 questions to ask some of the people applying at our company.
Can you guys throw in some good questions about Ruby, XML, Ajax, or Perl?
Thanks
How can I create a route of this format (in RubyonRails routes.rb file):
/#action/id
Specifically with the "#" character inserted before the action controller...for example, see http://lala.com/#album/some-album-id
thanks!
I've found a couple of different twitter gem (for ruby-on-rails) out there:
http://twitter4r.rubyforge.org/
http://twitter.rubyforge.org/
But I'm wondering if someone can rate them and provide a recommendation of either one or a new one.
Thanks
Hi,
I'm looking for a way to push/receive AMF0 / AMF3 messages in Ruby(Rails).
From what I read rubyAMF can only act as a server.
What I need is a library that allows client access to FMS/Wowza.Any ideas?
It's much harder than you'd think:
http://wiki.developers.facebook.com/index.php/Photos.upload
The tricky part is how to create the MIME multi-part message in Rails, which Facebook requires. I'm also using a Ruby Facebook API gem (mini_fb) which signs my other requests, and in addition to having no idea how to set up the MIME multi-part, even if I did I'm not sure how to add in the required signature values with the gem.
Please help!
I'm referring to http://www.codinghorror.com/blog/2005/10/equipping-our-ascii-armor.html but I'm getting drastically different results.
Does anyone know how to duplicate his blog post examples in Ruby?
My error messages in Rails look like the following:
"Email Your email is invalid."
Why is the name of the field prefixed within the string itself? It makes the error messages look awfully odd.
Is there anyway to circumvent this behavior so that I can just see "Your email is invalid."
I am consuming various XML-over-HTTP web services returning large XML files ( 2MB). What would be the fastest ruby http library to reduce the 'downloading' time?
Required features:
both GET and POST requests
gzip/deflate downloads (Accept-Encoding: deflate, gzip) - very important
I am thinking between:
open-uri
Net::HTTP
curb
but you can also come with other suggestions.
P.S. To parse the response, I am using a pull parser from Nokogiri, so I don't need an integrated solution like rest-client or hpricot.
I'm currently working on a largish RubyonRails project. It's old enough and big enough that it's not clear if all views are actually in use.
Is there any script/plugin out there that can generate a list of unused view files?
I am going to be away from the internet for a few weeks and would still like to get a project done. What steps should I take to make sure I have access to the things I need (ruby and ROR) while I will be disconnected?
Hey,
where would I place additions to stdlib classes in a rails project? Let's say something like:
class Date
def foo
'foo'
end
end
I thought about the initializer folder but it somehow felt wrong. Ideas?
I've read several other questions about material in order to learn RoR. But my question is can I start learning RoR without Ruby?
It's clear that the other way around is better, but I would rather try this way if it makes sense (somehow). Or learn both in parallel...
The authlogic rails gem is doing a LOWER in the sql query.
SELECT * FROM `users` WHERE (LOWER(`users`.email) = '[email protected]') LIMIT 1
I want to get rid of the LOWER part since it seems to be slowing down the query by quite a bit.
I'd prefer to just lower the case in the code since this query seems to be expensive.
I'm not sure where to change this behavior in authlogic.
Thanks!