I am writing an application in rails. I have multiple paragraphs of dynamic text which are listed vertically.
I am looking at neat way through javascript or CSS to vertically increase opacity of the group of paragraphs so the body of text has the appearance if disappearing as you go down the page.
<p>Some text obviously more than i am...
Taking the 2 examples below - how do they work?
map.resources :api_developers, :path_prefix => '-'
map.connect '-/:controller/:action/:id', :requirements => { :controller => /metrics|labs/ }
...
If you start a ruby app with the script/server command, what command do you use to stop it?
...
I am trying to get my Instant Rails working on my Windows 7 laptop.
The error I keep getting when trying to access my site files are:
c:/rails/ruby/lib/site_ruby/1.8/rubygems.rb:779:in 'report_activate_error'
RubyGem version error: rack<1.1.0 not~> 1.0.1> <Gem::LoadError>
from c:/rails/ruby/lib/ruby.site_ruby/1.8/rubygems.rb:214:in 'a...
New to RVM and playing with Rails 3 & Ruby 1.9.2 betas...
I've got two copies of rspec in a gemset. Was using beta.19 but need to downgrade to beta.18. changed my gemfile and then bundle install. now i have a mess...
*** LOCAL GEMS ***
. . .
rspec (2.0.0.beta.19, 2.0.0.beta.18)
rspec-core (2.0.0.beta.19, 2.0.0.beta.18)
rspec-expectati...
I implemented authlogic for my authentication system. I was hoping if there was a method to log in users by "username" OR "email" . The solution provided here http://goo.gl/Ato1 doesn't work as I don't have a "login" field in the database.
So is it that, I am missing the "login" field in the db? OR is there any other way of handling it?...
I am building a customer-facing website that requires me to build 1) some analytics for customers, and 2) to maintain some internal analytics for improving the site further. These require different kinds of information.
For customers
I am now capturing visits and events relevant to customers with fields such as visit_count and event_cou...
I have a resource, Inventory, that needs to be "show"ed about 4 different ways depending on the context. What is the best way to tackle this?
I was thinking that I could either pass in a parameter (param[:context]) that would have the "show" action render the right view. Or maybe I should make another controller, though that seems a...
What is the best way to run cron jobs on rails, when different machines have different jobs to do?
For example, server 1 runs cron job A, while server 2 runs cron job B
Is there a way to deploy the cron files along when we do a regular cap deploy?
...
It's not some kind of synchronization problem I readed before.
The code is quite simple.
The model:
class User < ActiveRecord::Base
attr_accessor :name, :email
validates_uniqueness_of :email, :on => :create, :message => "must be unique"
end
The rspec test:
require 'spec_helper'
describe User do
before(:each) do
@v...
I have the parent model of user and user has_many :events. From the user view, how can I find the most recent datetime (event.time) of event?
I'm thinking that a find_by will work, but I'm not sure on how to do that.
...
I'm using NGINX with Passenger to run a rails application on an Ubuntu server.
However, I'd like to have the rails app served from www.mydomain.com/store , and have
a wordpress install served from www.mydomain.com.
How would one go about setting up the nginx.conf?
...
I am wanting to test a function on one of my models that throws specific errors. The function looks something like this:
def merge(release_to_delete)
raise "Can't merge a release with itself!" if( self.id == release_to_delete.id )
raise "Can only merge releases by the same artist" if( self.artist != release_to_delete.artist )
#...
How can I pass the user_id on escape javascript while render on jquery?
Eg:
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$("#addPerson").click(function(){
$("#user tr:last").after("<%= escape_javascript(render :partial => 'user_item', :locals => {:user_item => User.new}) %>")
...
I'm trying to get the calendar_date_select gem working. I've added <%= calendar_date_select_includes 'blue' %> to my layout, and the actual helper call I'm trying as a test is <%= calendar_date_select_tag "e_date" %> (from the demo page)
The problem is that when I click on the calendar icon, nothing happens, and Chrome's element inspect...
Hello, i have Ruby class:
class Migrator
def self.migrate_old_categories
ActiveRecord::Base.establish_connection(:data_center_v2)
ActiveRecord::Base.table_name = "categories"
end
end
I need use it, as i used it always. For example: Category.find(:all)
So, how i can it, when i'm write: Migrator.migrate_ol...
I'm having a few integration issues. I have 2 models which need to be mapped so as to enable them to talk to the same table. So one model has a few attributes that are mapped to the corresponding columns in the table and likewise for the other model.
I've heard of aliasing, a technique that can be used. Help would be appreciated. Thank...
Hi There,
Im looking for a way to download a xml file. I use:
file_path = 'folder/' + xml_name + '.xml'
send_file file_path, :type => "text/xml"
but this always downloads me an empty file. The file itself has 16 KB of data in it...
why is that?
Maechi
...
I have run ruby script/generate scaffold test name:string.....
I want to reverse it.
Please give your opinion
...
I'm still a beginner with ruby and rails, and now I'm googling about methods for creating a tabbed menu, marking the list element of the currently active controller with a css class "current". There are many hits on google, but I haven't found any that I manage to get working.
I have my menu here:
<ul>
<li class="current"><%= link_t...