How to compress css files and javascript file in Ruby on rails
I want to compress css files and javascript files in my project. Is there any plugin to do that? :"> ...
I want to compress css files and javascript files in my project. Is there any plugin to do that? :"> ...
Hi, I need to start extracting events in a microsoft calendar. I've never done this before, so just want pointing in the right direction. Does anyone know if this is possible using Active directory? Anyone have any examples of where this has been done before? Thanks, Ian ...
What's the best way to write Resque-related specs in RSpec without stubbing the former? We currently use the following helper: @dir = File.dirname(File.expand_path(__FILE__)) def start_redis `redis-server #{@dir}/redis-test.conf` Resque.redis = "localhost:9736" end def stop_redis `rm -f #{@dir}/dump.rdb` pid = `ps -A -o pid,c...
Hi, I have a Ubuntu rails enviroment for playing around with ROR. Right now I am running Rails 2.3.8. I want to look into rails 3. Is it possible to run both dev enviroments side-by-side? If not, how do I clean up my rails 2.x system to install rails 3? Or do I need to setup a whole new Ubuntu machine? Any help, links... pointers wou...
My question is about my first Open Flash Chart not displaying at all in my Rails application (2.3.5 running on Vista). I am trying to implement: http://openflashchart2.heroku.com/chart_examples/pie. All the code is in but when I load the view using the server, there's nothing there! Pull up the blank page's source code and I see: sw...
Is there a way to have rails raise an error if an attempt is made to mass-assign attributes that aren't allowed by attr_accessible? This would be handy in development to remind me why my shiny new model isn't working, and also good to log in production in order to detect malicious activity. I'm using rails 2.3.8 but will probably soon ...
Hi, I am using Rails Fixtures to load some test data to my database and accidentally I introduced a foreign key out of range. To my surprise, the database accepted it despite having referential integrity constraints (that work). I tried with PostgreSQL and with MySQL InnoDB and both allowed. Example: Having in the database "Flavour...
I am creating a little website which is currently being translated into different languages. I use Rails' out-of-the-box translation: l18n. To change the localization, a parameter called locale must be given, e.g.: http://localhost:3000/?locale=nl. In ApplicationController this parameter is saved into a session variable and used as loca...
Rake db:seed populates your db with default database values for an app right? So what if you already have a seed and you need to add to it(you add a new feature that requires the seed). In my experience, when I ran rake db:seed again, it added the existing content already so existing content became double. What I need is to add some see...
We're building an app, our first using Rails 3, and we're having to build I18n in from the outset. Being perfectionists, we want real typography to be used in our views: dashes, curled quotes, ellipses et al. This means in our locales/xx.yml files we have two choices: Use real UTF-8 characters inline. Should work, but hard to type, a...
I'm talking half-ruby half-english in the following paragraph I have Persons and I have 'Pet's. Person has_many Pet. I have a table of Persons displayed with pets included in the cell, like: def pets_column(record) if record.pets.count == 0 'no pets' else record.pets.collect{|p| html_escape(p.to_label) }.join('<br />') en...
Hi, I was deploying my application in staging and it use to work properly. But in the recent deployment I am getting a crazy error like this, NoMethodError (undefined method `find_or_initialize_by_user_name' for #<Class:0xb6dd8388>): app/models/user.rb:49:in `find_or_create_account' app/models/user.rb:24:in `authenticate' app/con...
I have set up two models: user and post. Each post belongs_to a user. posts also have tags, using acts_as_taggable. On UserController#show I want to list the tags the user uses, sorting from most used to less used. Getting a list of tags is not hard, but how can I sort them? I use this to find the tags: @tags = [] @user.posts.each do |...
I have found how to render ActiveRecord objects in Rails 3, however I cannot figure out how to render any custom objects. I am writing an app without ActiveRecord. I tried doing something this: class AppController < ApplicationController respond_to :json ... def start app.start format.json { render :json => {'ok'=>true}...
INSERT INTO table (a,b,c) VALUES (1,2,3) ON DUPLICATE KEY UPDATE a='4', b='5', c='6' how to implement this type(insert and update) of sql in rails in single statement if possible ...
I'm saving nested objects within the objects they belong to, but when i do that they do not use the controller im saving but the parents controller. class Project < ActiveRecord::Base belongs_to :company belongs_to :user has_many :tasks accepts_nested_attributes_for :tasks, :allow_destroy => true end in the views i have somet...
Doing a very simple loop to display various data, for _test in @test ... I want to be able to, 1) get the first value _test.name.first()??? 2) get the previous value(meaning, the last iteration, so I i iterated the first time, I want to grab it again, when its in the second loop Thank you --- update What I mean is this Doug, 2. ...
I get the following error, and thought by using the .nil? method I could avoid getting an error by identifying the exception. But I don't. Line 40 shows I am getting an error...it seems to think that contact.latest_event is nil. But shouldn't .nil? help me avoid getting the error? Thanks...! ActionView::TemplateError (undefined meth...
I have a model as follows: Campaign has_many :companies, :through => :contacts There are many contacts with the same company. I just want one instance of each company. I tried the following: @campaign = Campaign.find(params[:id]) @companies = @campaign.companies But this shows me all the companies for every contact I believe. ...
I have a view which might be rendered from a controller or as a partial from another view. In all the code I've read, the controllers assign an instance variable "@item" and then call the view. On the other hand, when rendering it as a partial, it receives a parameter "item". So, all of my views start up this way: item ||= @item Ver...