similar to: Formatting timestamp objects

Displaying 20 results from an estimated 1000 matches similar to: "Formatting timestamp objects"

2006 May 16
4
question about strftime when called from partial.
Hi, I''m calling a helper I''ve written - format_time() that is called from my views with a given time that was selected from my database and was returned to the view via an instance variable. When I call format_time from a partial, I see that I get some kind of String error and the partial won''t render. Basically, the object being passed in to format_time is already a
2016 Oct 12
2
RFC: General purpose type-safe formatting library
On Wed, Oct 12, 2016 at 10:13 AM James Y Knight <jyknight at google.com> wrote: > > > I wonder what use cases you envision for this? Why does LLVM need a super > extensible flexible formatting library? I mean -- if you were developing > this as a standalone project, that seems like maybe a nice feature. But I > see no rationale as to why LLVM should include it. > We
2006 Jan 05
2
how to use a helper which is not inside app/helpers/
Hi, I wish to know it is possible to use a helper which is not inside the folder ''app/helpers'', if it is possbile, what should I do? Thanks you very much!!!! Saiho __________________________________________ Yahoo! DSL ? Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com
2006 May 13
1
undefined method `strftime'', being called from a partial.
Hi, I''m having an issue with calling a function that I''ve defined in ApplicationHelper called format_time: module ApplicationHelper def format_time(time) time.strftime("%a %b %d, %I:%M%p") end end I use this function in my views to format the Time.now that I would have stored in my tables as a DATETIME. I''m able to use this function, without any
2006 Apr 20
5
Noobie problems with helper
I have the following helper method in application_helper.rb: def format_date(date) day = to_s(date.day) month = to_s(date.month) time = to_s(date.time) date = day + "/" + month + " - " + time return date end I am trying to call this method in a view like this: <%= format_date(bounty.created_on) %> create_on is a timestamp in mysql. I am
2006 Jan 14
6
Error installing Rails/FastCGI/Apache2
Trying to install rails/fcgi/apache2. Following these instructions: http://xmlareas.com/ruby-rails-howto.html Using Fedora Core 4. I installed ruby and ruby-devel using apt-get. Everything under Adding FastCGI (optional) works fine up to the gem install fcgi part. Here is what happens: [root@paulbarry fcgi-2.4.0]# gem install fcgi -r -- -with-fcgi-lib=/usr/local/fcgi/lib
2006 Jan 20
6
Pre-populate db with yaml outside of testing?
Hi. What is the best way to pre-populate your database with records while developing, not testing? For example, I want to: 1) > [run this command to populate db] 2) > ruby script/server 3) now I can surf to localhost:3000 and my app will already have relevant data I''m hoping to use yaml to suck it in. Is there a way to use the Fixture class to handle this even though this is
2006 Apr 04
4
How to read rails documentation
One of the criticism I have heard about rails is that the documentation is bad. I must admit I have a hard time trying to follow it and I wonder if anyone can shed some light on it for me. For example, I am looking at the schema.rb file generated and I noticed this line: create_table "accounts", :force => true do |t| I thought to myself, what does :force => true mean? So I
2006 Jan 22
23
calculate users age
i know it''s probably really simple, how do i work out someone''s age if i have their d.o.b. stored as a date in my db. cheers -- Posted via http://www.ruby-forum.com/.
2006 Nov 01
2
How to: Individualized mass email with ActiveMailer - separate thread?
Hi, We are building a rails application that''s sort of a CRM + room/course booking. Among other things, it provides a centralized database of all the people the company has been in contact with. We want to provide the possibility of sending customized email messages to groups of contacts, for example a newsletter to 500 people starting with "Hi [:name:]". The naive approach
2006 May 31
7
How do you create a controller & view to create a list of objects?
I''m trying to figure out how to design a view and controller to work with a simple collection. I have a Foo that has many Bars, so here''s what I did: $ ruby script/generate model Foo $ ruby script/generate model Bar (Uncomment t.column, :name: :string in foo and bar migrations) (Edit Foo.rb and Bar.rb, add has_many :bars to Foo, belongs_to :foo to Bar) $ rake db:migrate $ ruby
2006 Feb 18
6
Naming join models
I''ve been playing around with EdgeRails and checking out some of the new features. The one that will probably have the biggest affect on my designs is join models (or :through associations). For those not familiar with this feature, it lets you replace your habtm association with a pair of has_many associations indirected through an intermediate model class. Looks like good
2006 Apr 04
2
loading data with migrations
Hello, I''m just taking a look at migrations, seems like a fantastic way to maintain the database. I am wonder if there is a way to maintain what I''ll call "reference data" along with the migrations. A lot of times in apps your have tables that have pretty static data, often used to generate select lists. Is there a way to insert the reference data into these tables
2006 Jan 17
2
Does anyone use RedCloth to allow end user input?
I was hoping to use RedCloth for textilize support to allow end users to enter textilized text (In blog comments, for example), but these bugs seem to make RedCloth unsuitable for that purpose: http://rubyforge.org/tracker/index.php?func=detail&aid=2989&group_id=216&atid=891 http://rubyforge.org/tracker/index.php?func=detail&aid=1779&group_id=216&atid=891
2006 Apr 28
2
Accessing fixtures from unit tests
I have set up some fixtures in test/fixtures/users.xml: # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html admin: id: 1 username: admin password: admin pbarry: id: 2 username: pbarry I have a unit test for my user model: require File.dirname(__FILE__) + ''/../test_helper'' class UserTest < Test::Unit::TestCase fixtures :users def
2006 May 07
2
label tag with errors?
I''d like to create a label tag that has a special css class if has errors. So Ideally, I''d like: <%= label(''object'',''property'',''Property'') %> To generate: <label for="object_property">Property</label> And if there are errors on object.property, generate this: <label
2006 Jan 04
3
date conversion
I have the date saved in a database in the following format ''20060102170020''. How do I go about converting the date in the format of January, 01, 1901? I searched all over and found something similiar using ''to_formatted_s''. However I only found support for converting month to a three letter format (e.g. ''Jan''). Is there an eaiser way?
2007 Feb 22
7
We can''t 100% remove our unit tests from the database, can we?
I hope this isn''t too rambly. This is sort of a brain dump of a subject I''ve been thinking about for months as I''ve used RSpec. Let''s say we''ve got a simple query method, that will find all the users in the DB older than 18. Our model could look like class User < ActiveRecord::Base def self.find_older_than(age) find :all, :conditions =>
2006 Jan 03
8
MacOS X Tiger Rails Install problem
According to the Hivelogic instructions <http://hivelogic.com/ articles/2005/12/01/ruby_rails_lighttpd_mysql_tiger> to correctly installing RoR on Tiger: > With RubyGems installed, Rails is a simple, one-line install: > > sudo gem install rails --include-dependencies > > Some people following these instructions report one of two errors > after performing this step.
2008 Jul 01
6
validates_associated & foreign keys
Hi, I''m struggling to get the validates_associated to work as I think it should be. I''m using: JRuby 1.1 rails-2.0.2 activerecord-2.0.2 activerecord-jdbc-adapter-0.8.2 My tables in MySQL: CREATE TABLE area_codes ( id INT UNSIGNED auto_increment primary key ... ); CREATE TABLE markets ( id INT UNSIGNED auto_increment primary key, ... ); CREATE TABLE