I am developing a secure Rails app on a secure internal server, though I still want to protect it from any kind of SQL injections or XSS attacks. I know that if I have a search box I can use something …
Tag: ruby-on-rails-3
How to use ANY instead of IN in a WHERE clause?
I used to have a query like in Rails: Which generates sql query like: Now I want to change this to use ANY instead of IN. I created this: Now when I use empty array ids = [] I get the folowing error: Answer There are two variants of IN expressions: expression IN (subquery) expression IN (value [, …]) Similarly,
Complex JOIN with ActiveRecord and Rails 3
I have the following models: I have to find all posts that belong to groups where user is a member. I have made it with this method: but it produces unefficient SQL: I want to make a query like this: How can I do this without using raw SQL? Answer something like this should work for you, although it requires
Default value not populating in migration with Rails and Postgresql
I am currently trying to run this migration: class AddDroppedProjectsCountToUser < ActiveRecord::Migration def self.up add_column :users, :dropped_projects, :integer, {:default=>0, :…