[Rails] Re: Release: tiny_mce 3.2.1.1-1

2009-02-22 Thread Mukund
Thanks for the plugin. It does make life easier while integrating tinyMCE. On Feb 23, 12:06 pm, Kieran P wrote: > Hey, > > Announcing the release of tiny_mce plugin 3.2.1.1-1. > > Changelog: > > * Rewrote test suite > * Added comments throughout the plugin for future developer >   - to all user

[Rails] Re: Use data from multiple tables in one view.

2009-02-22 Thread Matt Monsen
Thank you for your help with this. I knew I was looking into this and making it harder than it needed to be. It ended up that when I started second guessing myself I was troubleshooting the wrong issue. I was getting nil values on some of my note types which was causing the error and this wa

[Rails] How to invalidate the model caching in ruby?

2009-02-22 Thread Vikas Gholap
Hello All, I used rails caching to cache the model as in model language.rb file def self.cached_languages return Rails.cache.fetch('languages') { Language.all } end Now I want to add/delete some new language to database. So when the table "languages" changes it should reflect in view. For

[Rails] Re: format.html and redirect_to

2009-02-22 Thread Ricky
> A redirect is always a redirect. What i'm saying is that sometimes you   > don't want to redirect, in the aforementioned xml api example you'd   > probably just respond with an empty response with the appropriate http   > status code. An ajaxified interface is also a place where you might   > no

[Rails] Re: ActiveRecord::AssociationTypeMismatch

2009-02-22 Thread Me
Never mind. I looked at Ryan Bates complex forms example for the 100th time and got it to work using his method. SWEET. On Feb 23, 12:34 am, Me wrote: > I have 2 models: > > mop, has_and_belong_to_many :contacts > contact, has_and_belong_to_many :mops > > when I save my mop Ii have the users co

[Rails] geokit - using :through to connect models

2009-02-22 Thread Sergio Ruiz
hello.. i am currently trying to use :through to attach two of my models together using geokit. for some reason, i am running into a problem: ArgumentError: Unknown key(s): as i have two models, one that is geocoded, and one that belongs to that model. the models look like: ,[ employer.rb

[Rails] [ANN] Release: tiny_mce 3.2.1.1-1

2009-02-22 Thread Kieran P
Hey, Announcing the release of tiny_mce plugin 3.2.1.1-1. Changelog: * Rewrote test suite * Added comments throughout the plugin for future developer - to all users: feel free to fork this repo, make changes, and send a pull request * Split the plugin into 4 files to make it easier to maintain

[Rails] ActiveRecord::AssociationTypeMismatch

2009-02-22 Thread Me
I have 2 models: mop, has_and_belong_to_many :contacts contact, has_and_belong_to_many :mops when I save my mop Ii have the users coming in a an array: ["9",10"] I am doing this to asscociate each one to a mop: @contacts.each do |contact| @mop.contacts << contact end Contact(#44950470) ex

[Rails] Re: Redirect_to Vs Render_component

2009-02-22 Thread Srividya Sharma
I tried render_component, it seems to be slow. Thanks a lot. I will give this a try. Bharat Ruparel wrote: > 1. place where you want to save your hash: > > flash[:my_hash] = some_hash > > 2. place where you want retrieve your saved hash in flash: > > this_hash = flash[:my_hash] > > Now this

[Rails] Re: Updating database via cron?

2009-02-22 Thread willhaslett
Cron is a fine approach if you want an action to be based on time. If you want some action to be based on some user action, just redirect_to it after the file is uploaded. If you're using Cron, it's likely best to use a rake task. Quite easy, if you haven't done it before. Much like writing a lit

[Rails] Re: i18n Rails version compatibility?

2009-02-22 Thread Conrad Taylor
On Sun, Feb 22, 2009 at 9:39 PM, vimal wrote: > > Hi, > > I just want to know whether i18n is compatible with Rails-2.1 > I am a newbie in rails, i heard of globalisation plugin also. > So which one is the best to work with and if any other suggestions, > i would appreciate that > Hi, i18n w

[Rails] Re: dynamically changing a form from POST/CREATE to PUT/UPDATE

2009-02-22 Thread groovetrain
Awesome, thanks for the continued help. I tried the first thing you suggested, putting in the default AJAX settings. Being an inexperienced Rails programmer, I really don't know what you mean by number 2. How do I sort my rails headers? I'm fairly sure I'm running Rails 2.2.2 A few more thing

[Rails] i18n Rails version compatibility?

2009-02-22 Thread vimal
Hi, I just want to know whether i18n is compatible with Rails-2.1 I am a newbie in rails, i heard of globalisation plugin also. So which one is the best to work with and if any other suggestions, i would appreciate that In love with Ruby and Rails -

[Rails] Inserting string with special character in database.

2009-02-22 Thread Anubhaw Prakash
Hi all. I am having trouble in reading string containing special characters from file and storing them in database. For example, for string like '\x89\xA5\xCFI w...' it throws error "Incorrect string value". The string should be wrappped in duoble quotes, but i didn't find any method to do so. If

[Rails] Re: dynamically changing a form from POST/CREATE to PUT/UPDATE

2009-02-22 Thread groovetrain
Awesome, thanks for the continued help. I tried the first thing you suggested, putting in the default AJAX settings. Being an inexperienced Rails programmer, I really don't know what you mean by number 2. How do I sort my rails headers? I'm fairly sure I'm running Rails 2.2.2 A few more thing

[Rails] Re: Soft delete in HABTM tables

2009-02-22 Thread Preethi Sivakumar
Matt Jones wrote: > The has_and_belongs_to_many stuff works, but it isn't capable of > expanding. > For example, if you wanted to add the kind of 'soft delete' you were > thinking > about at the beginning, habtm wouldn't work. With has_many :through, > you can > add the flag to ProfileUserMapping

[Rails] Re: progress bar

2009-02-22 Thread Anubhaw Prakash
Steven Hilton wrote: > On Jan 28, 11:02�am, Anubhaw Prakash s.net> wrote: >> > Piyush. >> >> > On Jan 26, 1:08 pm, Anubhaw Prakash >> >> Thanks man. I will try it and respond to you. >> Anubhaw. > > > Did you use UploadProgress? The docs say you will also (probably) be > using drb, but I don't

[Rails] Re: about nested resources

2009-02-22 Thread Difei Zhao
Hi all, Since my commentable resources are not too many, I decided to do something like this in the comment controller: before_filter: find_resource private def find_resource if params[:article_id] @resource = Article.find(params[:article_id]) elsif params[:photo_id] @resource =

[Rails] Re: sorting by subsidiary class

2009-02-22 Thread Sarah Mei
>@category = Category.find(params[:id]) >@services=Service.find(:all, :order => "XXX", :conditions => > ['category_id = ?', @category.id]) @category = Category.find(params[:id]) @category.services.sort! { |x, y| x.reduction <=> y.reduction } --~--~-~--~~~-

[Rails] Re: How can I know if a file has been attached?

2009-02-22 Thread Eric
> How can I test if the variable "file" is empty or not? > Thank you! Answer should be somewhere here: http://www.tutorialspoint.com/ruby/ruby_methods.htm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rai

[Rails] Action Caching in Rails?

2009-02-22 Thread dare ruby
Dear all, I have created a rails application which has menus, like companies, users, departments, banners etc. When i click on my menu(I have used link_to_remote) i have rendered the corresponding pages without changing the layouts. I have fully used ajax concepts for all navigations. For listin

[Rails] Re: How do I access a variable defined in application.rb from within application.rhtml?

2009-02-22 Thread Sarah Mei
For actual read-only data that is an instance of a model class, I'd set up a class method instead. So for a default location, in Location.rb, def self.default_location @@default_location ||= Location.find_by_name("San Francisco") end This fixes your migration problem, doesn't reload it with ev

[Rails] How can I know if a file has been attached?

2009-02-22 Thread Guillaume Loader
Hello everyone! I have a form where we can attach files to a post. But I want to do different things depending wether a file is attached or not. So my question is : it it possible to know if a file is attached? I would say yes, we just need to see if the parameter "file" is empty. Here are my

[Rails] Re: Strange error when running rails 2.3 on ruby 1.9.1 on FreeBSD

2009-02-22 Thread Conrad Taylor
On Sun, Feb 22, 2009 at 3:34 PM, Grzegorz Junka wrote: > > David Nugent wrote: > > On 23/02/2009, at 8:04 AM, Grzesiu wrote: > > > >> Hi Conrad, > >> I am just starting my adventure with rails, so I am trying to start > >> with the most recent versions of ruby and rails to not have to upgrade > >

[Rails] Updating database via cron?

2009-02-22 Thread bongoman
Hi there I have a Rails app running that needs to have it's database periodically updated from an upload of a text file. The data file is in UIEE format and I'm working on a Ruby script that parses the file and inserts the data into MySQL. That should be OK I think at this stage. However I need

[Rails] Re: Storing just the year in the DB

2009-02-22 Thread Maurício Linhares
Store it as an integer, this will surely help you once you need to query it. - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Fri, Feb 20, 2009 at 8:02 PM, Scott Holland wrote: > > Hey, > > This may be a simple question, but I just wanted to ma

[Rails] Re: CHECK if param exists? please help

2009-02-22 Thread Phlip
>> 3.months.ago is an absolute time (probably "seconds since 1970"). So the >> "Time.now -" is implied. > > It was just for illustration. You gotta consider the audience, dude! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goo

[Rails] Re: How to get the ID of the object I just saved in the DB?

2009-02-22 Thread Guillaume Loader
It works! I've tried @post.id ! -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegro

[Rails] Re: How to get the ID of the object I just saved in the DB?

2009-02-22 Thread Eric
Try: puts @post.inspect and check your logs On Feb 22, 5:24 pm, Guillaume Loader wrote: > What do you mean? > That I should do this : @post.post_id ? > -- > Posted viahttp://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subs

[Rails] Re: How to get the ID of the object I just saved in the DB?

2009-02-22 Thread Guillaume Loader
What do you mean? That I should do this : @post.post_id ? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to r

[Rails] Re: CHECK if param exists? please help

2009-02-22 Thread Eric
On Feb 22, 3:46 pm, Phlip wrote: > Eric wrote: > > Use the ternary/comparison operator. I've removed your strptime stuff, > > but the idea is like so: > > > @from_date = params[:startdate] ? params[:startdate] : (Time.now - > > 3.months.ago) > > 3.months.ago is an absolute time (probably "seconds

[Rails] Re: How to get the ID of the object I just saved in the DB?

2009-02-22 Thread Eric
Don't you still have @post? On Feb 22, 4:25 pm, Guillaume Loader wrote: > Hello everyone! > > Does the method save return the ID ? > Because i'm doing this : > > if @post.save > flash[:notice] = 'Post was successfully created.' > end > > and I need the ID of the post I just created. I think it c

[Rails] Re: dynamically changing a form from POST/CREATE to PUT/UPDATE

2009-02-22 Thread s.ross
You're looking at the form. And it's not surprising it looks the same because you wrote it to be that way. Here's my guess, and I can't tell without (essentially) being you, watching your http requests, etc. Here's the flow of what happens when you submit your form: You: Think you did a

[Rails] How to get the ID of the object I just saved in the DB?

2009-02-22 Thread Guillaume Loader
Hello everyone! Does the method save return the ID ? Because i'm doing this : if @post.save flash[:notice] = 'Post was successfully created.' end and I need the ID of the post I just created. I think it could work with : Post.find(:last) but what if two people are posting at the same time? Th

[Rails] Re: How do I access a variable defined in application.rb from within application.rhtml?

2009-02-22 Thread Jeff Lewis
To initialize some db-read var (tidbit in your example) that would survive and be callable for each subsequent app request, you'll want to do so via lazy-initialization using a before_filter (mentioned by bill) in application.rb. How you store such lazy-init vars between requests depends on the s

[Rails] Re: Help w/ rake db:migrate error

2009-02-22 Thread Matt Jones
What's the goal? Using a global will mean that in production mode, $random_tidbit will only ever be set once. Even worse, if you're running a setup with multiple instances (pretty much any modern deployment), each one will get a *different* value. Do you want the value to be different for each req

[Rails] Re: problem with running rake db:migrate on a Rails app

2009-02-22 Thread Matt Jones
I'd recommend that you take a look at this: http://wiki.github.com/dchelimsky/rspec/rails-with-rspec-gems It should help you get rspec working. --Matt Jones On Feb 22, 7:39 am, polarapfel wrote: > It's a weird problem. > > rspec is installed for sure. I can use it in other Rails apps locally

[Rails] Re: CHECK if param exists? please help

2009-02-22 Thread Phlip
Eric wrote: > Use the ternary/comparison operator. I've removed your strptime stuff, > but the idea is like so: > > @from_date = params[:startdate] ? params[:startdate] : (Time.now - > 3.months.ago) 3.months.ago is an absolute time (probably "seconds since 1970"). So the "Time.now -" is implie

[Rails] Re: Use data from multiple tables in one view.

2009-02-22 Thread Michael Graff
You're making it harder than it needs to be, and I don't think you're understanding the relationships you are setting up. Since a Note has many types, if you did this at the console: >>> note = Note.find :first you would have a note. To list its types: >>> note.types Since this is an array,

[Rails] Re: Strange error when running rails 2.3 on ruby 1.9.1 on FreeBSD

2009-02-22 Thread Grzegorz Junka
David Nugent wrote: > On 23/02/2009, at 8:04 AM, Grzesiu wrote: > >> Hi Conrad, >> I am just starting my adventure with rails, so I am trying to start >> with the most recent versions of ruby and rails to not have to upgrade >> and struggle later, when it will be the time to deploy the app. > > >

[Rails] Re: creating a rails plugin

2009-02-22 Thread Amita Bhatkhande
My current application is for picture albums. These picture albums are oraganized/created as per the location. I am just doing it for my learning purpose. I am trying to make a user management plugin for it. The basic application worked with no plugin is working fine. Initially I had models

[Rails] Re: gem cleanup and rails 1.2.6 problem

2009-02-22 Thread elle
Logged as root, went to /System/Library/Frameworks/Ruby.framework/ Versions/1.8/usr/lib/ruby/gems/1.8 Running % whoami gives me: root Then running % ls -l gives me: total 8 drwxr-xr-x 31 root wheel 1054 31 Oct 16:51 cache drwxr-xr-x 32 root wheel 1088 31 Oct 16:51 doc drwxr-xr-x 31 root w

[Rails] Re: about nested resources

2009-02-22 Thread Gavin
Hypothetically, if one were to create three different types of comment would you just create a Comment model and then three other models that were subclasses? I've never played with subclasses in a rails app (other than the ones specified by rails) so I'm curious as to which whether this would b

[Rails] Re: Strange AR error ( column does not exist)

2009-02-22 Thread Frederick Cheung
On Feb 22, 8:39 pm, Felixyz wrote: > I'm trying to deploy a Rails app on a platform using Thin, after some > horrible sessions trying to make it work with fcgi. All is going well, > but my Application controller throws this error: > > ActiveRecord::StatementInvalid (PGError: ERROR:  column "fir

[Rails] Re: about nested resources

2009-02-22 Thread GS
That seems like a fine solution. what about just creating three different types of comments, article_comment, movie_comment, photo_comment? I'm not necessarily advocating for this, but it's an option, and it may be better. That way, you don't need the functions at all. and it should help keep y

[Rails] Strange AR error ( column does not exist)

2009-02-22 Thread Felixyz
I'm trying to deploy a Rails app on a platform using Thin, after some horrible sessions trying to make it work with fcgi. All is going well, but my Application controller throws this error: ActiveRecord::StatementInvalid (PGError: ERROR: column "firstpeer" does not exist LINE 1: SELECT * FROM "s

[Rails] Re: Tests failing for models with string primary key

2009-02-22 Thread Zac Zheng
Zac Zheng wrote: > Hi, > > My tests(rspec) are failing on models that has a String primary key. > Rails wrongly creates the test table with the primary key in Integer > format. As a result, the fixtures can not be imported, nor does > relationships match up. > > The database is imported and need

[Rails] Re: Strange error when running rails 2.3 on ruby 1.9.1 on FreeBSD

2009-02-22 Thread Grzesiu
Hi Conrad, I am just starting my adventure with rails, so I am trying to start with the most recent versions of ruby and rails to not have to upgrade and struggle later, when it will be the time to deploy the app. I am using passenger (as recommended on RoR site). In fact, I just discovered that

[Rails] Re: Storing just the year in the DB

2009-02-22 Thread Sazima
Scott, Why don't you use the default created/updated_at fields and just format the output to present only the year? Cheers, Sazima On Feb 20, 8:02 pm, Scott Holland wrote: > Hey, > > This may be a simple question, but I just wanted to make sure I was > doing it right. > > I need to store just

[Rails] Help with acts_as_audited

2009-02-22 Thread Diego Bernardes
Hi everyone, Im using the plugin acts_as_audited to audit my whole program, but i have a problem, when the change is in a association table (has and belongs to many) the change isnt captured by the plugin, anyone know any fast hot fix to this? Thanks! -- Posted via http://www.ruby-forum.com/.

[Rails] Re: dynamically changing a form from POST/CREATE to PUT/UPDATE

2009-02-22 Thread groovetrain
This is a long one, but it should be easy to parse through. Thank you for the reply. A couple of things: 1) The problem is with Firefox, that's what I'm using for development. 2) The above code (and the code from the codetunes.com site) give the error "can't modify frozen array" I set it as a

[Rails] Re: ActiveRecord column with reserved name 'class'

2009-02-22 Thread Brandon Joyce
Worked great for me as well. Thanks! -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@goog

[Rails] Re: CHECK if param exists? please help

2009-02-22 Thread Eric
Use the ternary/comparison operator. I've removed your strptime stuff, but the idea is like so: @from_date = params[:startdate] ? params[:startdate] : (Time.now - 3.months.ago) @to_date = params[:enddate] ? params[:enddate] : Time.now "If params[:startdate], then @from = params[:startdate], else

[Rails] replace_html with action template

2009-02-22 Thread dimi3
Hello All, I am trying to replace_html with an action template, not a partial. Currently I don't know how do it, I've renamed all my action to have _ in their names and I don't like this approach. I've tried render :update do |page|; page.replace_html 'content', :action => 'edit'; end and it won

[Rails] Re: CHECK if param exists? please help

2009-02-22 Thread Phlip
>from_date = Date.parse(params[:startdate]) if params[:startdate] > to_date = Date.parse(params[:enddate]) if params[:enddate] I forgot to mention I don't know if there's a Date.parse. Use Time.parse otherwise... --~--~-~--~~~---~--~~ You received thi

[Rails] Re: CHECK if param exists? please help

2009-02-22 Thread Phlip
First, some code style tips... > @from_date = Date.strptime(params[:startdate],"%d/%m/%Y") > @to_date = Date.strptime(params[:enddate],"%d/%m/%Y") Don't use @ unless other methods really want to see the variable. > @articles = @results.find(:all, > :con

[Rails] Is it possible to use restful_authentication as a gem?

2009-02-22 Thread vince
I'm starting a new project and was about to install restful_authentication as a plugin when I noticed on http://github.com/technoweenie/restful-authentication/tree/master that there is now a restful-authentication.gemspec Does this mean that we can (or should) install it as a gem instead of as a

[Rails] Re: Problem with test_truth

2009-02-22 Thread Phlip
Hello Guy wrote: > i use netbeans6.5 and i don't know how i can enter rake RAILS_ENV=test > db:migrate You cannot do Rails without learning and frequently using a command line. Either CMD.EXE or bash - pick your poison! -- Phlip --~--~-~--~~~---~--~~ Y

[Rails] CHECK if param exists? please help

2009-02-22 Thread Dave Smith
hi folks. i want to check if a param exists if not to set it to a default value for my date range filter. in my controller i have: @from_date = Date.strptime(params[:startdate],"%d/%m/%Y") @to_date = Date.strptime(params[:enddate],"%d/%m/%Y") @articles = @results.find(:all,

[Rails] Re: Problem with test_truth

2009-02-22 Thread Hello Guy
Phlip wrote: >> test_truth(MyDataTest): >> ActiveRecord::StatementInvalid: Mysql::Error: Unknown column 'mydata' in >> 'field list': INSERT INTO `members` (`person_id`, `created_at`, >> `updated_at`, `mydata`, `id`, `mydata_id`) VALUES (1, '2009-02-22 >> 18:00:49', '2009-02-22 18:00:49', 'verei

[Rails] Re: model test

2009-02-22 Thread Phlip
Arshak Navruzyan wrote: > Hello, > > I have a before_validation_on_create callback on one of my models. It > works fine when I run it through the console in dev/prod but in test > (also going against mysql) it doesn't seem to fire. Post your test code. It should raise an exception on create! ,

[Rails] Re: Problem with test_truth

2009-02-22 Thread Phlip
> test_truth(MyDataTest): > ActiveRecord::StatementInvalid: Mysql::Error: Unknown column 'mydata' in > 'field list': INSERT INTO `members` (`person_id`, `created_at`, > `updated_at`, `mydata`, `id`, `mydata_id`) VALUES (1, '2009-02-22 > 18:00:49', '2009-02-22 18:00:49', 'verein1', 238752903, 4)

[Rails] Re: Problem with test_truth

2009-02-22 Thread Phlip
Frederick Cheung wrote: > >> I find the rake db:migrate commands to be less than comprehensive here. >> Sometimes one rake command understands testing, but another one does not. > If you run > > rake > > to run your unit tests, that should clone the structure from the > development database to

[Rails] degrading ajax calls - how?

2009-02-22 Thread Shilo Ayalon
Hey - I have a few ajax calls in my app that I'm not really sure how to degrade to html. For the most part, these are functions that insert or remove elements to/from the dom. For example, I have my own edit-in-place on the data, which is called by start_edit action. This action renders an rjs te

[Rails] Re: Problem with test_truth

2009-02-22 Thread Hello Guy
Hello, ok it works :)) there are tables in my test database : there are the right tables :) i think :(( if i run the unit test def test_truth assert true end there is one error: 1) Error: test_truth(MyDataTest): ActiveRecord::StatementInvalid: Mysql::Error: Unknown col

[Rails] Re: Problem with test_truth

2009-02-22 Thread Hello Guy
Frederick Cheung wrote: > On Feb 22, 3:48�pm, Phlip wrote: >> > If you run > > rake > > to run your unit tests, that should clone the structure from the > development database to the test one. > > Fred Hello Philip and Fred, i use netbeans6.5 and i don't know how i can enter rake RAILS_EN

[Rails] Re: why can't to_xml read my mind?

2009-02-22 Thread Frederick Cheung
On Feb 22, 5:23 pm, Phlip wrote: > Frederick Cheung wrote: > > > In either case at the point that to_xml is called the association is > > loaded - if it just spat every loaded association into the xml it > > would be very easy to accidentally include stuff. > > Our unit tests include checks tha

[Rails] Re: why can't to_xml read my mind?

2009-02-22 Thread Phlip
Frederick Cheung wrote: > I think it is hard for AR to distinguish between > > m = Model.find ... > m.do_something_that_causes_association_foo_to_be_loaded > m.to_xml > > m = Model.find ..., :include => :foo > m.to_xml Then that's what I mean by reading my mind. In a desktop app, where 'a' mi

[Rails] model test

2009-02-22 Thread Arshak Navruzyan
Hello, I have a before_validation_on_create callback on one of my models. It works fine when I run it through the console in dev/prod but in test (also going against mysql) it doesn't seem to fire. Anything special about rake test and callbacks? Thanks, Arshak -- Posted via http://www.ruby-f

[Rails] Re: about nested resources

2009-02-22 Thread Gavin
Ah - I think I understand now. I would add a column to the comments table called 'kind' (as in, 'kind of comment') The column should be an integer column with limit 1. Then assign a different integer value to determine what kind of comment it is. i.e., 1 = article 2 = photo 3 = movie When you

[Rails] Re: Expiring cache from a rake task

2009-02-22 Thread Wincent Colaiuta
On Feb 11, 11:14 am, "Levy Carneiro Jr." wrote: > I tried this also: > > class ArchivesObserver < ActionController::Caching::Sweeper > (...) > > In this case, there's no error, and it does nothing at all. The > public/archives.html just stays there. > > I'm trying my best to avoid hacking it, us

[Rails] Re: How do I access a variable defined in application.rb from within application.rhtml?

2009-02-22 Thread bill walton
Hi Eric, On Sat, 2009-02-21 at 12:45 -0800, ericindc wrote: > Title pretty much explains it. I'd like to set a variable the stores > a single Model object inside of application.rb since it will be used > on every single page. I've tried both class and instance variables, > but to no avail. The

[Rails] Re: date filter

2009-02-22 Thread Dave Smith
Norm wrote: > Dave Smith wrote: >> anyone know any examples of good code for a date range filter i can add >> to my app to return only selected articles within that range based on >> their created at date. >> > > Here is how I fetch something similar. It is just a simple find. > Substitute th

[Rails] Re: Problem with test_truth

2009-02-22 Thread Frederick Cheung
On Feb 22, 3:48 pm, Phlip wrote: > Hello Guy wrote: > > thanks, i know, in test database are not tables. my question is: why are > > not > > the tables for test database create? > > i did database migration and it creates only tables for development > > database but > > not for my test database

[Rails] Re: Bump! why can't to_xml read my mind?

2009-02-22 Thread Frederick Cheung
Did my earlier reply not make it through ? On 22 Feb 2009, at 15:46, Phlip wrote: > > Railsters: > > I suspect the answer is "because they invented it before inventing > eager loading". > (I don't think so. eager loading was there way back in rails 1.0/1.1 (possibly before, I just know it wa

[Rails] Help to make a SaaS

2009-02-22 Thread Eder Gobbi
Hi, I'm not a programmer, but i have an great idea about developer a SaaS with Ruby to use Twitter as base.. this project can be great sucess. If you believe, reply! []sss Eder Gobbi --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

[Rails] Bump! why can't to_xml read my mind?

2009-02-22 Thread Phlip
Railsters: I suspect the answer is "because they invented it before inventing eager loading". The first minor issue with to_xml's refusal to read my mind is it's not DRY (like my mind!): Model.all(:include =>{ :this => :that }). to_xml(:include =>{ :this => :that }) With eager loadi

[Rails] Re: Problem with test_truth

2009-02-22 Thread Phlip
Hello Guy wrote: > thanks, i know, in test database are not tables. my question is: why are > not > the tables for test database create? > i did database migration and it creates only tables for development > database but > not for my test database. where can be the problem? I find the rake db

[Rails] sorting by subsidiary class

2009-02-22 Thread DanC
Hi all, My app contains categories, service and discounts. A category has_many :services A service belongs_to :category and has_one discount A discount belongs_to :service On each category show page I list all of the associated services, but would like to order them by some of the entries in th

[Rails] Re: how to add javascript directly to the view

2009-02-22 Thread Phlip
Adam Akhtar wrote: > Im incorporating ajax / javascript stuff for the first time in my > project and im a bit confused by all various methods available, rjs, > prototype, javascript etc so please excuse me if this is an obvious > question. > > Whilst looping though an array of model objects in m

[Rails] Re: como consultar en oracle

2009-02-22 Thread pepe
Hola otra vez, Para tu información y por si acaso te interesa, he intentado usar el paginador de Rails pero no me ha funcionado. La razón es que con Rails 2 han dejado de incluirlo. En el libro "The Rails Way" he encontrado información sobre el tema y parece que hay 2 versiones de paginadores qu

[Rails] Re: about nested resources

2009-02-22 Thread Difei Zhao
Gavin wrote: > Difei, > > If a comment only belongs to either an article, movie or a photo > (never more than one) you could add methods in the model to determine > which it is for. > > For example: > > class Comment > > def article_comment? > !article_id.nil? > end > end > > @comment

[Rails] Using after_filter to remove image after render

2009-02-22 Thread naevity
Hi Everyone, I tried doing this and it's not working as I would expect it, but I'm not sure if it's even possible. I have an app that generates and image on request and displays it to the user. To cut back on storage, and some security, I'd like the app to receive the view request, render the ima

[Rails] Re: Strange error when running rails 2.3 on ruby 1.9.1 on FreeBSD

2009-02-22 Thread Conrad Taylor
On Sun, Feb 22, 2009 at 6:24 AM, Conrad Taylor wrote: > On Sun, Feb 22, 2009 at 5:15 AM, Grzesiu wrote: > >> >> I am trying on a fresh FreeBSD and I haven't had rails installed >> before. Also ruby19 has just been updated to 1.9.1 so I don't think >> reinstalling everything would make any differ

[Rails] Re: parsing an xml file from another website

2009-02-22 Thread InventoryTrackers
I've just recently spent a week learning how to export data using the Builder::XMLMarkup. In effect I created this object and populated it with data from my Rails database and sent it flying with a send_data method. I've been reading how one then imports data and loads this into the Rails database

[Rails] Re: Strange error when running rails 2.3 on ruby 1.9.1 on FreeBSD

2009-02-22 Thread Conrad Taylor
On Sun, Feb 22, 2009 at 5:15 AM, Grzesiu wrote: > > I am trying on a fresh FreeBSD and I haven't had rails installed > before. Also ruby19 has just been updated to 1.9.1 so I don't think > reinstalling everything would make any difference. It is like a fresh > install. And your steps worked on my

[Rails] Re: how to add javascript directly to the view

2009-02-22 Thread Adam Akhtar
Thank you all for your input. Thank you hassan for answering some of my doubts abou this methodology. Basically this is the result of my lack of knowledge. The rows in this table represent tasks in a todolist. Theres a delete option for each task via ajax and the deleted row is taken out via

[Rails] Re: how to add javascript directly to the view

2009-02-22 Thread Hassan Schroeder
On Sun, Feb 22, 2009 at 3:26 AM, Adam Akhtar wrote: > Whilst looping though an array of model objects in my view I want to be > able to show or hide a div that contains the message "Your list is > empty". > <% if items.empty?> > #the following is not the correct way > $('no-items-msg').show Wh

[Rails] Re: Use data from multiple tables in one view.

2009-02-22 Thread Matt Monsen
class Note < ActiveRecord::Base has_many :type end class Type < ActiveRecord::Base belongs_to :note end -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails:

[Rails] Re: Strange error when running rails 2.3 on ruby 1.9.1 on FreeBSD

2009-02-22 Thread Grzesiu
I am trying on a fresh FreeBSD and I haven't had rails installed before. Also ruby19 has just been updated to 1.9.1 so I don't think reinstalling everything would make any difference. It is like a fresh install. And your steps worked on my system because I could install rails without problems. It

[Rails] Re: Use data from multiple tables in one view.

2009-02-22 Thread Conrad Taylor
On Sun, Feb 22, 2009 at 4:59 AM, Matt Monsen < rails-mailing-l...@andreas-s.net> wrote: > > > > > Hey Matt, what's the relationship or association between a 'note' and a > > 'type'? > > > > Right now I have it set up as a one-to-many relationship. I am not sure > that that is the correct relation

[Rails] Re: Use data from multiple tables in one view.

2009-02-22 Thread Matt Monsen
> > Hey Matt, what's the relationship or association between a 'note' and a > 'type'? > Right now I have it set up as a one-to-many relationship. I am not sure that that is the correct relationship that I want for this however. Basically the type will be a |Coaching|Attendance|Performance| n

[Rails] Re: Use data from multiple tables in one view.

2009-02-22 Thread Conrad Taylor
On Sun, Feb 22, 2009 at 3:58 AM, Matt Monsen < rails-mailing-l...@andreas-s.net> wrote: > > Thanks for help in advance with this. > > I have been trying to understand how to get this to work correctly and I > have been having trouble getting it to work the way that I think it > should. > > I would

[Rails] Re: how to add javascript directly to the view

2009-02-22 Thread Conrad Taylor
On Sun, Feb 22, 2009 at 4:30 AM, Frederick Cheung < frederick.che...@gmail.com> wrote: > > > > On Feb 22, 11:26 am, Adam Akhtar > wrote: > > Im incorporating ajax / javascript stuff for the first time in my > > project and im a bit confused by all various methods available, rjs, > > prototype, ja

[Rails] Re: problem with running rake db:migrate on a Rails app

2009-02-22 Thread polarapfel
It's a weird problem. rspec is installed for sure. I can use it in other Rails apps locally from within the same Ruby/Rails setup. I tried adding a git submodule for rspec to vendor/gems/rspec from the rspec github page. Still, the same errors. I switched back to Ubuntu's Ruby installation to t

[Rails] Re: Problem with test_truth

2009-02-22 Thread Hello Guy
Frederick Cheung wrote: > On 21 Feb 2009, at 20:51, Hello Guy wrote: > >> assert true >> >> whats here wrong? >> i understand table members is not exist in alldataserver_test, but >> why? >> here is a mistake with migration i think, can someone help me? >> > it means that there is a fixtures

[Rails] Re: how to add javascript directly to the view

2009-02-22 Thread Frederick Cheung
On Feb 22, 11:26 am, Adam Akhtar wrote: > Im incorporating ajax / javascript stuff for the first time in my > project and im a bit confused by all various methods available, rjs, > prototype, javascript etc so please excuse me if this is an obvious > question. > > Whilst looping though an array

[Rails] Re: running console commands in rails

2009-02-22 Thread Frederick Cheung
On Feb 22, 3:12 am, Stewart wrote: > Hey, > > how can i run console commands form my rails app. I have tried using > backticks. eg > > result = `svn checkout ` > > They work fine when i run the sciprt from the command line with > > ruby something.rb > > but when the same script is run form my

[Rails] Re: Error in Mysql Connection

2009-02-22 Thread Aruna Venkataraman
Freddy Andersen wrote: > I'm guessing in you database.yml file you have this: > development: > adapter: mysql > > So you need todo this: > > # gem install mysql or if mysql is in a none standard area you need to > point to mysql_config like this: > # gem install mysql -- --with-mysql-config=/u

[Rails] Re: cant seem to run rails console

2009-02-22 Thread Conrad Taylor
On Sat, Feb 21, 2009 at 11:30 PM, Stewart wrote: > > Hello, > > I cant seem to run my console. I get the following error > > ~/workspace/testtube $ ./script/console > Loading development environment (Rails 2.2.2) > /usr/local/ruby_test/lib/ruby/site_ruby/1.8/i686-darwin9.6.0/ > readline.bundle: dl

  1   2   >