How to swap prototype for jquery in rails 3.0?
How to swap prototype for jquery in rails 3.0? ...
How to swap prototype for jquery in rails 3.0? ...
Hi there, Just wondering if there's a way to run Rails tests without dropping the database. I'm currently only executing unit tests and am using the following rake command to do so: rake test:units. Thanks for the help in advance! Just in case this is relevant: Rails 3 Ruby 1.8.7 (MRI) Oracle 11g Database activerecord-oracle_enhan...
I'm trying to find the best way to make paperclip urls secure, but only for secure pages. For instance, the homepage, which shows images stored in S3, is http://mydomain.com and the image url is http://s3.amazonaws.com/mydomainphotos/89/thisimage.JPG?1284314856. I have secure pages like https://mydomain.com/users/my_stuff/49 that has i...
Also known as the <<"User has many Databases" question.>> The environment My app is modeled like so: user has_many databases database has_many tables table has_many rows row habtm(+value) columns you get the idea! So instead of modelling a database inside a database, I would like to have: a sqlite3 database that h...
I'm trying to implement a Cache Sweeper which would filter a specific controller action. class ProductsController < ActionController caches_action :index cache_sweeper :product_sweeper def index @products = Product.all end def update_some_state #... do some stuff which doesn't trigger a produ...
Hi, I wrote a Rack Middleware which analyse response to find esi:include tags, clone the rack env, set a new PATH_INFO and REQUEST_URI (according to tag's src attribute) then @app.call with the new env. It proceed well, but Rails (2.3.9) doesn't seem to recognize the completely the route (request_uri: "/esi/audience"), as it fallback ...
In Rails, you can create an anchor tag that spans multiple lines doing something like the following: <% link_to target_url_path do %> <span class="title">Example</span> <span class="excerpt">Neque porro quisquam est qui dolorem ipsum...</span> <%= image_tag 'example.png', :class => 'thumbnail' %> <% end > I'm wondering how...
Wed Sep 22 13:15:02 -0400 2010 to this format 2010-08-23 13:15:02 -0400 The left is Time.now The right is 30.days.ago =\ ...
Whenever I develop sites using Rails, I create a controller called "front" which has actions like "index," "how," and "about." So, the home page, "How It Works," and "About Us" pages can be accessed via /, /how/, and /about. My routes look like this: map.root :controller => "front", :action => "index" map.connect 'how', :controller => ...
I need to change session during one cucumber scenario. For example Given session name is "1st unauthenticated user" And make some things Given session name is "2st unauthenticated user" And make some other things I found a solution, but it doesn't work with Rails 3, Cucumber and Capybara. Are there any other solutions? ...
I'm trying to get a Rails (version 2.3.5) app set up to run RSpec and Autotest. I've got both rspec (1.2.9) and rspec-rails (1.2.9) vendored as plugins in the app. I then have ZenTest 4.4.0, Autotest (4.3.2) and Autotest Rails (4.1.0) gems installed. Whenever I run the autotest command in the app, all I get is this: loading autotest/r...
I have got this 'query' @product_collections = ProductCollection. #includes(:products). #does not do anything joins(:products). #this at least gives me the products (in articles table) group("tags.id"). where("articles.category_id = ?", @category.id). where("articles.available = ?", true). ...
So I'd like to be able to add a longer block of text to a YAML locale file in Rails. However, the YAML parser gives syntax errors for blocks that appear to be fine! I've read through the Ruby YAML cookbook and it seems like these examples below should all work, but they don't. config/locales/tx.yml This one works fine: tx: states: ...
Hi everybody! (Hi Dr. Nick!) I'm trying to tighten things up for our app admin, and in a few places we have some pretty skeezy code. For example, we have Markets, which contain Deals. In several places, we do something like this: @markets = Market.find(:all, :select => ['name, id']) @deals = Deal.find(:all, :select => ['subject, disc...
I am passing 4 values from my form. attr1 attr2 attr3 attr4 On before_save def before_save if condition == true # here i want to revert changes of attributes ... # Right now i am doing this for reverting.... self.attr1 = self.attr1_was self.attr2 = self.attr2_was end end Any better way to revert changes except...
home_controller.rb: class HomeController < ApplicationController def index @title = "tags" @posts = Post.tag_counts.collect do |tag| Post.tagged_with(tag).first end @posts.flatten.uniq @posts = @posts.paginate :page => params[:page], :per_page => 8 end end index.html.erb: <%- for post in @posts -%> ...
This is a fairly common refactoring, Martin Fowler calls it 'move field'. Given 3 models: class Person < ActiveRecord::Base has_one :contact_details has_one :address end class ContactDetails < ActiveRecord::Base end class Address < ActiveRecord::Base end how do I refactor, including migration, the has_one address from Person to ...
In a Rails controller, I can set a cookie like this: cookies[:foo] = "bar" And specify that the "secure" (https-only) flag be on like this: cookies[:foo, :secure => true] = "bar" :secure is false by default. How can I have cookies be secure by default, application-wide? This is on Rails 2.3.8 ...
I have an app that sets creates EC2 instances - I have a resque task that will configure the server (via ssh) once it's up and running: Net::SSH.start(server.dns_name, 'root', :keys => ['~/.ssh/testkey.pem'], :paranoid => false, :verbose => :debug) do |ssh| result = ssh.exec!("ls -l") puts result end I get an...
Background: We have a dependency on an externally managed database. This is a company-wide resource. We have a read-only account into it and have no control over or input into the schema or contents. Issue: We're using ActiveRecord as our ORM into said resource; we manage the connection information separate from our central db connectio...