Intro
We have a project to design and implement this semester. For our project, we chose to create an inventory system that uses Android phones for clients. More information on that portion of the project.
The Problem
The next problem that we have run into is that we are to design some kind of intermediary server that authenticates u...
I assume that for all of these i need to get a better understanding of Ruby itself but does (say) Padrino translate directly into skills i would use in Rails or is it indirect.
I am a PHP programmer but as i have used PHP frameworks which are clones of Rails i am finding it not too difficult
...
I have to do calculations on my database. When I was using mysql, it wasn't a problem, but now that I use PGSQL, I see the following issue :
I have 3 tables : dogs, users and dogs_users, the join table (it's a n-n, every dog can have multiple users and every user can have multiple dogs)
When I do the following :
ree-1.8.7-2010.02 > Us...
Can I use send_file to send a file on a drive other than the Rails.root drive? I've tried both options below. I need to use the second option but Rails doesn't like using a drive other than the volume on which it is on.
This works:
def action
send_file "C:\\rails_root\\public\\files\\file.ext"
end
This doesn't:
def action
send_f...
My app has the following models: user and watch_list. User has attributes id, name and WatchList has attributes user_id, friend_id.
class WatchList < ActiveRecord::Base
belongs_to :user
has_many :friends, :class_name => "User", :foreign_key => "friend_id"
end
class User < ActiveRecord::Base
has_one :watch_list
has_many :friend...
Scenario:
:author has_many :posts
My searchlogic-based web form search for authors:
f.text_field :name_like # author name
f.text_field :posts_title_like # post title
searchlogic named scopes use inner joins, so I'll only get authors returned if they have posts. Authors without posts are not returned.
How do I force an outer join w...
I have a has_one association that is reflective on the objects of another association. I have Project, which has many ProjectUsers, which tie Projects and Users. One of those ProjectUsers is authoritative. The issue is that both the has_one and the has_many use the same foreign key on project_users. Here's the base idea of the models...
I have recently been researching NoSql options. My scenario is as follows:
We collect and store data from custom hardware at remote locations around the world. We record data from every site every 15 minutes. We would eventually like to move to every 1 minute. Each record has between 20 and 200 measurements. Once set up the hardware rec...
def self.source_root
File.join(File.dirname(__FILE__), 'templates')
end
...
I am using rakismet to check for spam in comments.
Right now, I do it in a before_create callback and I am wondering in a production site, if this is the most efficient way of doing it or should this be done by a background job.
Can you share your experience in terms of how much delay does this add to the responsiveness of your product...
I'm trying to trigger a warning when a price is entered too low. But for some reason, it always returns true and I see the warning regardless. I'm sure there something wrong in the way I'm doing this as I'm really new to RoR.
In model:
def self.too_low(value)
res = Class.find_by_sql("SELECT price ……. WHERE value = '#{value}'")
res....
I'm working on a bit of an extension for Radiant CMS that processes survey data. I'm trying to use form_for, fields_for and various helpers that rails provides inside pre-defined radius tags. These tags would generate the survey on Radiant pages.
Here's what I have in mind for integrating with Radiant:
<r:survey id="200">
<r:survey:f...
What is "development mode?" How do I enable this so I do not have to shut down my server to see changes?
...
Trying to integrate some friendly_id gem functionality on a controller method.
Essentially, I have a Market object, which has its URL created based on a custom method. Since it's based on a custom method, friendly_id won't update the URL when the Market object gets updated. Friendly_id does offer a redo_slugs rake task, but when I cal...
Whenever I click the serialize button to return results I'll get something like "tree_list[0][id]=2&tree_list[1][id]=3...".
View:
<a href="#" onclick="alert(Sortable.serialize('tree_list'));return false">Serialize</a>
<ul id="tree_list">
<%= render :partial => "tree_item", :collection => @tree_items %>
</ul>
<%= sortable_element('tree...
I am working on a Rails 3 project that relies heavily on screen scraping to collect data mainly using Nokogiri. I'm aggregating essentially all the same data but I'm grabbing it from many difference sources and as time goes on I will be adding more and more. However I am acutely aware that screen scraping can be notoriously unreliable....
I'm a little baffled here and can't seem to find the proper resource or information online.
I'm creating a comment model in which any model can be commented on, here is what I did:
class Comment < ActiveRecord::Base
belongs_to :commentable, :polymorphic => true
belongs_to :user
end
So the comment additionally has the columns comm...
I am confused about where I should put code for a model that is modified in the view for another controller. Huh? Here's the situation:
I have a Phone model and an associated controller. In the Phones view you can modify simple things like who the Phone is assigned to. In order to change more low-level things about the Phone, you ha...
I want to run a method, on the startup of the rails server. It's a model method.
I tried using config/initializers/myfile.rb, but the method was invoked during migrations, so it SELECTed from a nonexistant table.
Tried environment.rb also, but the class does not exist yet (and will probably have the same problem with migrations)
I don...
It seems most people advice going with some sort of hardware solution in load balancers for DOS attacks. I notice if you try to do a curl on any major/semi-major website you get a 301.
For someone with a modest budget, what's the best way to protect against DOS attacks in rails, if there is no solid solution, what's the 2nd best thing s...