ruby-on-rails

Issue with accepts_nested_attributes_for while using authlogic_oauth

I have the following models: class Merchant acts_as_authentic has_one :store accepts_nested_attributes_for :store end class Store belongs_to :merchant end I am using authlogic_oauth gem for Twitter authentication. While registration I save the Merchant and the Store model. If I disable the oauth authentication both models are...

Rails gem or code to flag malicious user behavior in real-time?

Is there an existing gem or code that will flag malicious user behavior in real-time? i.e. not something where I manually comb the log files for 404s or suspicious accesses (e.g. sql injection attempts, js inserted into text fields, etc.?) For instance, today I noticed requests like this in the log. ActionController::RoutingError (No r...

Restful Authentication plugin and Users model

Hi I have a question about using the restful-authentication plugin. I have it working just fine with the "out of the box" setup. I am trying to add a user partial form nested into a form of another model. I can not seem to figure out how to have this form add a new user to the users model. I have other nested forms that work just fine...

Ruby on Rails query by datetime range ( last 24, 48, etc... hours )

I'm trying to build a query that will search for recent entries based on column 'last_login_at'. This is a datetime field with time zone (i.e. Time.zone.now) When I execute User.find(:all, :conditions => ["last_login_at < ?", 24.hours.ago]) I get nothing. Alternatively I can define today as Time.zone.today and yesterday as Time.zone...

Parse then Store XML Data from API in Ruby on Rails

Hello All, I know there have been a ton of entries about this topic but I haven't seen the complete picture yet of how to store the data. I am trying to make a system that reads then parses then stores information about events from the Yahoo Upcoming API. The url returns a pretty simple xml that looks like this <event> <id>489875230<...

rails: mass-assignment security concern with belongs_to relationships

I've been reading up on rails security concerns and the one that makes me the most concerned is mass assignment. My application is making use of attr_accessible, however I'm not sure if I quite know what the best way to handle the exposed relationships is. Let's assume that we have a basic content creation/ownership website. A user ca...

Facebooker install on Windows

Hey guys, I'm trying to install facebooker using: gem install facebooker on my Win7 machine. It returns this: checking for ruby/st.h... * extconf.rb failed * Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configu...

Upgrading rails / reloadable

Hi, I have tried to upgrade my rails in order to deploy a old RoR app into Heroku, Unfortunately I'm getting some errors and I have no clue how to fix this. It seems that include Reloadable from my model isn't working anymore: /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:105:in `const_missing...

How do I have something happen *after* the scriptaculous highlight effect

render :update do |page| page.visual_effect :highlight, row_id, :duration => 20, :startcolor => "#FFCC33", :restorecolor =>"" page << "alert('hi');" end In the above code, I have a highlight effect that occurs and lasts for 20 seconds, after the highlight effect completes, I want to have an alert popup. Currently, the alert immedia...

suggestions on how to present/process a form with many textfields

I am on Rails. I have a form that has many text fields (about 13). It looks very bulky and smudged together. From a rails point of view, the form deals with 3 models. I am looking for some demo links or links that intuitively deal with forms and many textfields. Can I break the form into various different forms with next button a...

Rails - Succinctly finding the parent resource of a polymorphically nested resource

Suppose I have a polymorphic structure like this. map.resources :bar, :has_many => :foo map.resources :baz, :has_many => :foo map.resources :qux, :has_many => :foo class Foo belongs_to :parent, :polymorphic => true end class FooController < AC before_filter :find_parent ... private def find_parent # ugly way: @parent = if ...

Parsing blog post tags from a text_field

Ok, so you know how you ask a question here, and in the "Tags" field you can enter several space-separated tags into a single text field? I'm trying to replicate similar behavior in my Rails app. Except instead of questions, I'm doing a blog app (which has "posts"), and tagging those. I'm using "form_for" to build the quick form. Insid...

How to tell to TextMate ignore my Katz's Bundler folder in "Go to File"?

I use Katz's Bundler to manage gem dependencies. Who know, how to tell to TextMate ignore my "vendor/bundler_gems" folder in "Go to File"? Image demonstrate my little problem. You can see, what I want to find my application.sass, instead "Go to File" find lots of trash from bundler folder. ...

How can I let my users upload multiple pictures at the same time?

I have a ruby on rails website. One feature allows people to upload pictures but users find it painstaking to upload pictures one at a time. What is the best way to allows users to upload multiple pictures at the same time? ...

Two Model Classes - One Database Table

Do you ever do this? I'm writing a Rails app. I have a situation where I have a Task model (and table), the Task has attributes, people that are allowed to view it, and a hierarchy (it may be under a project, or a business). I also have an AssignmentController that exposes some views and functionality to the individual that's assigned...

How to store different site parameters in database with Rails?

Hello. There are a lot of ways to store site preferences in database. But what if I need to manage datatypes. So some preferences will be boolean, others strings, others integers. How can I organize such store? ...

I am getting this error when run ror project "C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- haml (MissingSourceFile)"

I am getting this error when run ror project "C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- haml (MissingSourceFile)" ...

Cygwin memory problem, only swap is being used?

Hi, I am porting a rails application to Win2K3 server, with cygwin. The application is up and running, but start to respond slowly very soon. I find that cygwin is only allocating swap to all process ( with top ), not using the 2GB memory available. Even Windows Task Manager shows high CPU usage but lots of free memory. How can I track...

Rails - embedded polymorphic comment list + add comment form - example?

Hey, all. Working on my first Rails app. I've searched all around - read a bunch of tutorials, articles, and forum posts, watched some screencasts, and I've found a few examples that come close to what I'm trying to do (notably http://railscasts.com/episodes/154-polymorphic-association and ep 196 about nested model forms), but not exac...

Delayed Job Rake Task Failing

I'm trying to get delayed job to work as a rake task, but for the life of me I can't figure out what I'm doing wrong. Given the following setup: #config/environment.rb Rails::Initializer.run do |config| config.gem 'delayed_job' end #Rakefile begin require 'delayed/tasks' rescue LoadError STDERR.puts "Run `rake gems:install` ...