ruby-on-rails

What are the security issues with diaspora?

I heard allot of buzz around the security issues with diaspora, can someone summarize what they were? ...

How is event-driven programming done?

My question is pretty simple: how is event-driven programming actually achieved? To elaborate: I have a Rails application, every time a user makes a change on the website, the model writes that "change" to a text file (as JSON.) What I'd like to do is hook an IRC bot to that "event." (the creation/modification of the text file.) How i...

What's the reasonable time for generating web page?

Hi there! I'm working on web app (Rails 3 based). And I really don't like the time it takes to generate the page - depending on the displayed data it takes up to 2.5 and even 4 seconds. So I just was wondering what is the average reasonable time for generating page in your apps. Saying you check the generation time, e.g. it's 750ms and...

Using a DISTINCT clause to filter data but still pull other fields that are not DISTINCT

I am trying to write a query in Postgresql that pulls a set of ordered data and filters it by a distinct field. I also need to pull several other fields from the same table row, but they need to be left out of the distinct evaluation. example: SELECT DISTINCT(user_id) user_id, created_at FROM creations ORDER BY crea...

Cucumber + Spork = undefined method `visit' for #<Object:0x82fcc588> (NoMethodError) ???

I'm tearing my hair out here. When running Cucumber in Spork-compatible mode (--drb) the visit() method doesn't work. Simply trying the feature step: When I go to the home page calls web step: When /^(?:|I )go to (.+)$/ do |page_name| visit path_to(page_name) end Running "cucumber" on the command line produces the following err...

How do I structure the domain architecture of my web app? - practical advice

So I am creating a web app, that will give each registered user a unique 'workspace'. This workspace should be accessible by anybody they give permission to. I have the main domain for my marketing website, but I am trying to figure out how to manage the nitty-gritty domain management of the web app itself. Should I buy generic domains...

Rails/CSS Display flash messages in a main column of a fixed layout with 2 columns

Hi, For my rails app, I use a fixed layout with 2 columns (a main and a rightside). For now, flash messages are displayed in the content div but I would like to show flash msg in the "main" div ( main < content < container ). I don't know what it the best to do it. In fact, did I have to create a flash message helper and add it in all...

Rails 3, Custom Actions, and HTML request methods

I don't really understand the pro's and con's of using "post" vs "get" vs "put" requests, on custom controller actions, and whether to use links or forms/buttons. So let's say I have a simple to-do list with tasks, and a tasks controller, and I want a "complete" action where I find a specific task in the db and update it's status attri...

ruby on rails + xampp + mysql (windows 7)

I am trying to use the mysql package included in xampp with ruby on rails on windows 7, but cannot seem to get them to work together. I have rails 3.0.0 and xampp 1.7.3 rails works with sqlite within xampp just fine, but when attempting to use mysql via "rails new project -d mysql; cd project; bundle install" I get the following: In...

Should there be a "ruby" directory under "vendor" in a Rails 3 project?

Is it normal to have the following directory structure under "vendor" in a Rail 3 project? /vendor/ruby/1.8/bin /vendor/ruby/1.8/cache /vendor/ruby/1.8/doc /vendor/ruby/1.8/gems /vendor/ruby/1.8/specifications When I delete the "ruby" directory, and run "bundle update", the whole structure is recreated. "gem env" yields noth...

Ruby on Rails OAuth application works on client but not on server (OAuth::Unauthorized (401 Unauthorized))

Hi, I have a Ruby on Rails application that works great in my computer and in my server. I'm moving this application to another server that runs on another hosting service, and I got a problem related to the OAuth Ruby Gem. Any request I do using OAuth gem, I get: OAuth::Unauthorized (401 Unauthorized): oauth (0.4.3) lib/oauth/consu...

Rails: URL helper to combine URL params?

How would I either create a helper or use the built-in link_to helper to combine URL params? For instance, say I'm on a page with the URL parameter of status: http://example.com/items?status=new I have another link for carriers that I'd basically want to append to that, like so: http://example.com/items?status=new&amp;carrier=fedex ...

Prevent certain properties from being updated?

In rails, when updating a model, how do you prevent certain properties of the model from being updated when using a call like: @user.update_profile params[:user] Since anyone can just create a form input with a name like 'password', how can you filter the set of properties that you are allowing to be updatable? Is this what attr_XXX ...

How many concurrent upload can a Rails App handle

We are expect to serve few thousands uploads within 2 or 3 minutes. Most of the uploads will be about 20 -> 200 Mb. Technically, I think upload has not much to do with Rails, but rather the WebServer (Apache/Nginx), so as long as the server can handle concurrent requests, then there not much work for Rails app to do (except to move the f...

How is it that find_by_id, etc. work on an ActiveRecord array?

Forgive me if I've got my terminology wrong; I am still quite new to Ruby and Rails. For school I am working on an RoR project as part of a team. I was pair programming with a teammate, who actually happens to be experienced in RoR; and I wrote something like the following: d = self.deliverables.find_all_by_lifecycle_id(self.lifecycle_...

runing rake task

Hi! Why when i run task : my_project> rake import:twitter Task.path: lib/task/import_twitter.rake namespace :import do task :twitter => :environment do puts "importing...." end end then tests also run? In the console output: importing.... Loaded suite C:/Ruby/bin/rake Started Finished in 0.001 secon...

How to call views from multiple controllers?

I have multiple controllers having their own views (Index.html). Now, I want to create another controller (Say "Welcome") and I want to include views of all other controllers into the view of "Welcome", so that all the views are available on single page and welcome page gets updated automatically whenever I change any individual index pa...

Where should I put external web service processing logic in Rails?

In my rails application I use some external web services: twitter, google picasa, flickr etc. Where should I put code related to processing responses of these services? ...

To get Analytics data and show on page what's the most popular items, should the code belong to Model, Controller, or View?

Suppose there is a call to get Analytics data from a third party or through our cache data on a server, for the "most popular items", and we show these items' names on all of our pages, should we put this code in Model, Controller, or View (Helper) component? Maybe it is not strictly Model, because it is not directly in our data store. ...

replacing ActionController::Routing::RouteSet::Mapper.send in Rails3 plugin

Hi there, I'm following http://edgeguides.rubyonrails.org/plugins.html and at chapter 8, I'm told to add: ActionController::Routing::RouteSet::Mapper.send :include, Yaffle::Routing::MapperExtensions In order to add the routes of my plugin in my Rails app... Unfortunately, ActionController::Routing is deprecated in Rails 3 and I don't ...