I have two models, Users and Groups. Each group can have many users and each user can be in many groups.
I currently have something simple like:
User:
has_many :groups
Group:
has_many :users
So I have a groups_users table which is just creating rows with group_id and user_id.
I want to add another column to this, (which I h...
I'm interested in sending all Rails application logging to a database (MySQL or MongoDB) either in addition to or instead of to a log file. There are a few reasons, most of them surround doing things somewhat similar to Google Analytics - basically log file analysis. We already use Google Analytics, but there are a variety of things we...
I'm integrating my Ruby on Rails app with a usps shipping system. Once you make a postage request, you pay for that postage and it's nonrefundable.
Postage requests will return you an xml response including a base64 string, which is the shipping label.
I'm able to render the shipping label in a view, however to make it foolproof, I w...
I'm working on my first rails app and am struggling trying to find an efficient and clean solution for doing automated checkouts and deployments.
So far I've looked at both CruiseControl.rb (having been familiar with CruiseControl.NET) and Capistrano. Unfortunately, unless I'm missing something, each one of them only does about half of...
I'm wondering if there is an easy way to look up a user's local time zone in Rails using only an IP address. I don't want users to have to input their time zone themselves. Do I have to use JavaScript or is there a different way?
...
I am seeing very, VERY strange behavior when I run certain reports:
>> p = BigDecimal.new('0.1785990254E5')
=> #<BigDecimal:b649b978,'0.1785990254E5',16(16)>
>> q = BigDecimal.new('0.76149149E4')
=> #<BigDecimal:b64968d8,'0.76149149E4',8(16)>
>> p-q
=> #<BigDecimal:b6495ab4,'0.124498764E5',16(32)>
>> p.to_s
=> "17859.90254"
>> q.to_s
=>...
Railscasts did a great tutorial on how to do multiple edit from a selection. But I want to build on top of it. What if I want to do more actions (edit and destroy)? This is similar to gmails ability to preform different actions on mail.
I created my form and I have a drop down menu of the action. The form goes to a action in my con...
There have been a decent amount of questions about mysql spatial datatypes, however mine is more specific to how best to deal with them within a rails MVC architecture.
I have an input form where an admin user can create a new point of interest, let's say, a restaurant and input some information. They can also input a human-readable ...
$ script/plugin install git://github.com/rails/exception_notification.git
$ ls vendor/plugins/
exception_notification
$ cat vendor/plugins/exception_notification/init.rb
require "action_mailer"
require "exception_notifier"
require "exception_notifiable"
require "exception_notifier_helper"
$ script/console
Loading development environm...
I have a index set up so I can facet on category ids, as following:
define_index
...
has categorizings.category_id, :type => :multi, :facet => true
end
When I do a query like Listing.facets, I get the correct results in a hash, with each category_id pointing at its count. :)
The only problem is Thinking Sphinx runs a database qu...
I'm working on a legacy database that is complete non-sense. I have a table called movie that contains columns with names like c00, c01, c02 and so on. The table also uses non-standard primary_keys. So I've created a class called movie like this:
class Movie < ActiveRecord::Base
set_table_name "movie"
set_primary_key "idMovie"
...
I have several models with fields that are integers. I also have hashes that associate integers with strings (1 => Blue, 2 => Red, that sort of thing).
How do you turn these into dropdown lists in an ActiveScaffold (http://github.com/activescaffold) controller? Do you need custom code, or is there just a customization that I'm not see...
Right now, whenever Rails is updated and I upgrade the frozen version in my application (by installing the new gem and refreezing it), in order to commit it into my repository, I need to do two steps: first delete the old version, and second add the new version. This seems to be because when the new version is frozen, the old version (al...
I have a 1:1 has_one / belongs_to relationship between users and registrations. One user has one registration.
When I try to iterate through users in a view and display their registration info (source to follow), I get the following error:
ActionView::TemplateError: You have a nil object when you didn't expect it! The error occurre...
I'm working on a Rails application and I would like to know what's the best way to strip blocks of CSS or JavaScript.
<style>
...
</style>
-or-
<script>
...
</script>
I'm using the *strip_tags* helper to take care of most of the HTML, but it leaves a bunch of CSS when the content contains inline CSS. Thanks
...
I guess this question has been asked a lot around. I know Rails can scale because I have worked on it and it's awesome. And there is not much doubt about that as far as PHP frameworks are concerned.
I don't want to know which frameworks are better.
How much is difference in cost of scaling Rails vs other frameworks (PHP, Python) assum...
Heya! Rails boob here.
In my User model I could have:
has_many :tasks
and in my Task model:
belongs_to :user
Then, supposing the foreign key 'user_id' was stored in the tasks table, I could use:
@user.tasks
My question is, how do I declare the has_many relationship such that I can refer to a User's Tasks as:
@user.jobs
......
Prologue: I know about gems.
I use Drupal at work. In case you don't know, Drupal is modules. There is a framework and a core framework, but when you build a site in Drupal, installing and configuring modules is most of the work.
So what, being new to Rails, I have a pet project and I am trying to build a login/user system. I've read...
Hi,
I have a table of strings in my database. I select on of them.
How I can find the most similar string in the rest of the table ?
...
When I was developing my RoR skills with some basic tutorials I encountered a problem. What I am trying to achieve is having comments belonging to posts, with no separate index or individual view. This part was easy.
Here comes tough one. I want post_comment_url to return address with fragment identifier: http://example.com/posts/2#comm...