[Rails] new gem: renshi - a templating language

2009-07-12 Thread Nicholas Faiz
Hello, Just letting people know about a project of mine - a new templating language; Renshi. See http://github.com/biv/renshi/tree/master . It's also available via gem installation through rubyforge. It was originally modelled on Python's Genshi, although it turned out rather differently. It'd b

[Rails] Re: Associations - Better solution?

2009-07-12 Thread Jitu
Have you tried, class Audit < ActiveRecord::Base belongs_to :auditor, :class_name => 'User', :foreign_key => 'auditor_id' belongs_to :tenant, :class_name => 'User', :foreign_key => 'tenant_id' end class User < ActiveRecord::Base has_many :auditors has_many :tenants end On Jul 12, 9:43 

[Rails] Re: Ways to chart data in Rails?

2009-07-12 Thread JannaB
But frankly, it really appears to me that fusion charts is the best looking. Am I mistaken? Do you guys see a better open source solution? -Janna B --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"

[Rails] Re: Ways to chart data in Rails?

2009-07-12 Thread Ratnavel P S
Open Flash charts? -- 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@googlegroups.com To

[Rails] Re: RESTful Authentication Plugin Not Found

2009-07-12 Thread Ratnavel P S
Download from here, http://github.com/technoweenie/restful-authentication/tree/master Or Follow these steps, http://agilewebdevelopment.com/plugins/restful_authentication Cheers, Ratnavel -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You recei

[Rails] Re: Installing mysql with macports

2009-07-12 Thread Arzumy
Hi, have you tried reinstalling xcode? Or even better, upgrade to latest and greatest xcode? Cheers! Arzumy On Jul 13, 1:44 am, mikej wrote: > Not sure if this is off topic, but there doesn't seem to be an obvious > place to ask this question. > > I am trying to use MacPorts to install mysql.  

[Rails] Re: observe_field on text_field

2009-07-12 Thread JannaB
And when I get rid of my observe_field in my partial...this error goes away, so clearly the error is related to the js created by observe_field (even if by my not getting good parameters into it). So now I just need to figure out an alternative to observe_field. It's a pity ruby doesn have an obs

[Rails] Re: observe_field on text_field

2009-07-12 Thread JannaB
I dont see anything in firebug that shows me what happens on a get or post -- just the static snapshot of the page in a nice, expandable tree view. HOWEVER, I do notice in my mongrel monitor window when I submit the form I get the following (I have NO idea what this means! But I am certain it is a

[Rails] Re: Problem deploying app on bluehost

2009-07-12 Thread saurabh
Thanks a lot all for the support and inputs. I want to know which is the best option for me to try to deploy ror application. I went for bluehost as they were preety cheap(42$ for an year including a domain name ) and had many features ( shell etc). I want to know if i can get a similar deal w

[Rails] Re: Problem deploying app on bluehost

2009-07-12 Thread saurabh
Thanks a lot Roger. On Jul 10, 9:45 pm, Roger Pack wrote: > saurabh wrote: > > Hi , > > I am new to ror and deploying my first app spot.us on bluehost , I am > > getting the following error : > > > Application error > > Rails application failed to start properly > > > I google and found that it

[Rails] Re: observe_field on text_field

2009-07-12 Thread bill walton
Janna, On Sun, 2009-07-12 at 19:11 -0700, JannaB wrote: > Below is the html created.can you see why the > observer is not passing on to /channels/ > speakassfromwhereaboutspartial ? -Janna B Not right off I can't. What does Firebug tell you it's doing when you change the text? Do you see t

[Rails] Re: RESTful Authentication Plugin Not Found

2009-07-12 Thread 庄杰
you can find what you want on github! --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group,

[Rails] named_scope and its :order function.

2009-07-12 Thread 刘子嘉
Could someone help me to solve my problem?I'm using named_scope,and there seems to be a little problem... Can I sort a model by another model's column?For example,I have a "users" table,it has a "value" column.And in the user.rb: has_many :articles in the article.rb: belongs_to :user named_scope :

[Rails] Re: How to check if a table is empty ?

2009-07-12 Thread Jitu
I think this is the classic scenario to use find_or_create_by_ # No 'Summer' tag exists Tag.find_or_create_by_name("Summer") # equal to Tag.create(:name => "Summer") # Now the 'Summer' tag does exist Tag.find_or_create_by_name("Summer") # equal to Tag.find_by_name ("Summer") you can

[Rails] Re: RESTful Authentication Plugin Not Found

2009-07-12 Thread JangoSteve
Are you getting that error when you try to do "script plugin/ install..." in the command line? Or an application error you are getting after you install the plugin? On Jul 12, 1:33 pm, Kevin Meyer wrote: > I am new to Rails, but when I try to install the REST Authentication > it always says plug

[Rails] Re: How to check if a table is empty ?

2009-07-12 Thread Frederick Cheung
On Jul 13, 2:41 am, Marnen Laibow-Koser wrote: > Conrad Taylor wrote: > > [...] > > > I agree with Fred's approach because if you're testing for emptiness, > > you > > should do the least amount of work to determine it.   > > Excellent point. > > > For example, > > > Model.first  =>  will creat

[Rails] expire action in different subdomain

2009-07-12 Thread linojon
hi, is there a way to specify a subdomain in expires_action? i have admin.foo.com to edit pages, which are cached in www.foo.com My update action tries to expire the cache but it seems to look for a cache in tmp/views/admin.foo.com/ and doesnt expire the one in tmp/ views/www.foo.com/ --~

[Rails] Re: observe_field on text_field

2009-07-12 Thread bill walton
On Sun, 2009-07-12 at 12:29 -0700, JannaB wrote: > Many Thanks Bill. You're very welcome. > > Form.Element.EventObserver('inoutexplanation' > Form.Element.EventObserver('inoutexplanation' Notice that we're right back where we started from. The id of the element you say you want to observe

[Rails] Re: observe_field on text_field

2009-07-12 Thread JannaB
Bill, Sorry, it;s because I wrote the last post while playing around with it trying to experiment (I really only have one version on this system).BUT, "associate_inoutexplanation" is the id of the text field I am trying to observe, as well as what I put into my observe_field to observe it. Th

[Rails] Re: Ideas why this rake task isn't saving one of my models?

2009-07-12 Thread Rick
On Sun, Jul 12, 2009 at 9:50 PM, JangoSteve wrote: > > I'm not sure this is what is causing your problem, but according to > your models, a Match has_many Playergames, which would mean that each > Playergame has a match_id, correct? However, in your script, you are > saving the Playergames before

[Rails] Re: RJS render errors when user clicks away before render completes

2009-07-12 Thread JangoSteve
Javascript errors happen all the time due to weird browsing behavior and usually go unnoticed by typical users (unless of course it's being caused by your actual code). The fact that the error pops up in an alert window is a debugging feature of the Development environment in Rails. In other words

[Rails] Re: Ideas why this rake task isn't saving one of my models?

2009-07-12 Thread Frederick Cheung
On Jul 13, 3:02 am, Rick wrote: > On Sun, Jul 12, 2009 at 9:50 PM, JangoSteve wrote: > > Good point, about saving the games first,  but I'm curious, what the > heck is going on that I can't seem to get match to save even with > those game save lines commented out (as above.) I'm just trying to ge

[Rails] Re: Ideas why this rake task isn't saving one of my models?

2009-07-12 Thread Rick
Ah thanks Frederick. I'll start using save! And with that, I figured it out. I had a validates_presence_of condition that wasn't getting met. Yea a duh moment. I just figured something like would have thrown an error if there was an issue in my validate conditions. I'm glad I know about save! now

[Rails] Re: named_scope and its :order function.

2009-07-12 Thread Frederick Cheung
On Jul 13, 4:01 am, 刘子嘉 wrote: > Could someone help me to solve my problem?I'm using named_scope,and there > seems to be a little problem... > Can I sort a model by another model's column?For example,I have a "users" > table,it has a "value" column.And in the user.rb: > has_many :articles > You

[Rails] Re: Use of self in a class

2009-07-12 Thread JangoSteve
In other words, you just use def get_payment_types if get_payment_types is to be performed on a specific instance of that class, and def self.get_payment_types if it is just a generic function for that class... E.g. def get_payment_types ... end pt = PaymentType.new pt_types = pt.get_payment_

[Rails] Re: Ideas why this rake task isn't saving one of my models?

2009-07-12 Thread JangoSteve
I'm not sure this is what is causing your problem, but according to your models, a Match has_many Playergames, which would mean that each Playergame has a match_id, correct? However, in your script, you are saving the Playergames before the Match, meaning a match_id has not yet been created. When

[Rails] Re: How to check if a table is empty ?

2009-07-12 Thread Marnen Laibow-Koser
Conrad Taylor wrote: [...] > I agree with Fred's approach because if you're testing for emptiness, > you > should do the least amount of work to determine it. Excellent point. > For example, > > Model.first => will create 1 or no objects > Model.all=> will create table size of N or no

[Rails] Re: undefined method error from atom builder

2009-07-12 Thread Frederick Cheung
On Jul 13, 2:12 am, Nathan Beyer wrote: > I have a simple controller that takes a request, looks up some data > and then returns the results as either HTML or Atom. The HTML response > works fine, but the Atom Builder is blowing up with an undefined > method error that I can't figure out. It se

[Rails] Can ActiveResource use ActiveRecord::Dirty?

2009-07-12 Thread JangoSteve
So, I've been working with Rails for quite a while, but pretty new to actually digging in and patching/plugging the actual source methods of Rails modules. I'm trying to use ActiveRecord to create some Ruby wrappers for a couple API's, but having to patch/rewrite so many of the ActiveResource met

[Rails] undefined method error from atom builder

2009-07-12 Thread Nathan Beyer
I have a simple controller that takes a request, looks up some data and then returns the results as either HTML or Atom. The HTML response works fine, but the Atom Builder is blowing up with an undefined method error that I can't figure out. It seems to be failing when the ActiveRecord instance is

[Rails] Re: Locking, and How to Test it

2009-07-12 Thread Brian
Ah, great idea. So in the absence of a mock object framework*, is something like the following fairly standard? MyModel.send(:define_method, :save!) { raise ActiveRecord::StaleObjectError, "Boom!" } ... #test handling of race condition here MyModel.send(:undef, :save!) Since "save!"

[Rails] Re: Locking, and How to Test it

2009-07-12 Thread Frederick Cheung
On Jul 13, 1:04 am, Brian wrote: > This is a two part question.  Which type of locking should I use > (optimistic vs. pessimistic) and then how do I account for locking in > my tests? > > My scenario is essentially the purchase of a unique item where the > first person to click "Buy" gets the i

[Rails] Re: get DB data to rhtml file

2009-07-12 Thread Frederick Cheung
On Jul 13, 12:55 am, Mark Preston wrote: > I got it to work by changing my method in the mystuff_controller to look > like this: > > require 'Mystuff' > > class MystuffController < ApplicationController > >     def index > >       �...@my =  Mystuff.find( :all) > >     end >   end > > The only

[Rails] Ideas why this rake task isn't saving one of my models?

2009-07-12 Thread Rick
Newbie here working on an application that has a "Match" model and each Match can have some "Playergame" models. The rails apps is actually working, but I needed to now import some initial data from a csv file, so I built a rake task to handle the import. The problem is that for some reason I can

[Rails] Locking, and How to Test it

2009-07-12 Thread Brian
This is a two part question. Which type of locking should I use (optimistic vs. pessimistic) and then how do I account for locking in my tests? My scenario is essentially the purchase of a unique item where the first person to click "Buy" gets the item and everyone else is out of luck. As a sin

[Rails] Re: get DB data to rhtml file

2009-07-12 Thread Mark Preston
Mark Preston wrote: > Frederick Cheung wrote: >> On Jul 13, 12:38�am, Mark Preston >> wrote: >>> � � � �...@my = �Mystuff.find( :all) >> This >> >>> Mystuff#index >>> <%me.each do |mr|%> >> >> and this need to match - the instance variables are copied over for >> you. >> >> Fred > > Fred than

[Rails] Re: get DB data to rhtml file

2009-07-12 Thread Mark Preston
Frederick Cheung wrote: > On Jul 13, 12:38�am, Mark Preston > wrote: >> � � � �...@my = �Mystuff.find( :all) > This > >> Mystuff#index >> <%me.each do |mr|%> > > and this need to match - the instance variables are copied over for > you. > > Fred Fred thanks, I saw that and changed it, but sti

[Rails] Re: get DB data to rhtml file

2009-07-12 Thread Mark Preston
Mark Preston wrote: > Matt Harrison wrote: >> Mark Preston wrote: escape nasties (if appropriate)) >>> >>> Extracted source (around line #2): >>> >>> 1: Mystuff#index >>> 2: <%mystuff.each do |mr|%> >>> 3: =mr.m1 >>> 4: <% end %> >>> >>> >>> HELP :) >> >> Ok, in the controller you are as

[Rails] Re: get DB data to rhtml file

2009-07-12 Thread Frederick Cheung
On Jul 13, 12:38 am, Mark Preston wrote: >       �...@my =  Mystuff.find( :all) This > Mystuff#index > <%me.each do |mr|%> and this need to match - the instance variables are copied over for you. Fred --~--~-~--~~~---~--~~ You received this message because yo

[Rails] Re: Use of self in a class

2009-07-12 Thread Frederick Cheung
On Jul 13, 12:36 am, Buzz Hill wrote: > class PaymentType < ActiveRecord::Base > >   def self.get_payment_types >     payment_types_all = find(:all, :select => "display_name, > stored_name" , :order => :display_name) >     # Creates a nested array of [[display_name, > stored_name],[display_name

[Rails] Re: get DB data to rhtml file

2009-07-12 Thread Mark Preston
Matt Harrison wrote: > Mark Preston wrote: >>> escape nasties (if appropriate)) >> >> Extracted source (around line #2): >> >> 1: Mystuff#index >> 2: <%mystuff.each do |mr|%> >> 3: =mr.m1 >> 4: <% end %> >> >> >> HELP :) > > Ok, in the controller you are assigning @me to your find. Try: > >

[Rails] Use of self in a class

2009-07-12 Thread Buzz Hill
class PaymentType < ActiveRecord::Base def self.get_payment_types payment_types_all = find(:all, :select => "display_name, stored_name" , :order => :display_name) # Creates a nested array of [[display_name, stored_name],[display_name, stored_name]] payment_types = payment_types_all.

[Rails] Re: get DB data to rhtml file

2009-07-12 Thread Matt Harrison
Mark Preston wrote: > Frederick Cheung wrote: >> On Jul 12, 11:47�pm, Mark Preston >> wrote: >>> Mystuff#index >>> <%mystuff.each do |mr|%> >>> mr.m1 >>> <% end %> >>> >> if you want to display the result of a ruby expression (eg one of your >> attributes) then you need to use <%= ... %> (don't f

[Rails] Re: get DB data to rhtml file

2009-07-12 Thread Matt Harrison
Mark Preston wrote: > I am trying to get data out of a database to my rhtml file. The files > look like this: > > Model > --- > mystuff.rb > > class Mystuff < ActiveRecord::Base > set_table_name "mytable" > set_primary_key "id" > end > > > Controllers > -- > > mystuff_cont

[Rails] Re: get DB data to rhtml file

2009-07-12 Thread Mark Preston
Frederick Cheung wrote: > On Jul 12, 11:47�pm, Mark Preston > wrote: >> >> Mystuff#index >> <%mystuff.each do |mr|%> >> mr.m1 >> <% end %> >> > > if you want to display the result of a ruby expression (eg one of your > attributes) then you need to use <%= ... %> (don't forget to use h to > escap

[Rails] Re: get DB data to rhtml file

2009-07-12 Thread Frederick Cheung
On Jul 12, 11:47 pm, Mark Preston wrote: > > Mystuff#index > <%mystuff.each do |mr|%> > mr.m1 > <% end %> > if you want to display the result of a ruby expression (eg one of your attributes) then you need to use <%= ... %> (don't forget to use h to escape nasties (if appropriate)) Fred > Than

[Rails] Re: How to check if a table is empty ?

2009-07-12 Thread Conrad Taylor
On Sun, Jul 12, 2009 at 11:28 AM, Frederick Cheung < frederick.che...@gmail.com> wrote: > > > > On Jul 12, 7:15 pm, Eric wrote: > > On Jul 12, 10:19 am, "Älphä Blüë" > > wrote: > > > > > > But the variable is unnecessary, and in fact, a more concise way of > > > > saying the same thing would be

[Rails] get DB data to rhtml file

2009-07-12 Thread Mark Preston
I am trying to get data out of a database to my rhtml file. The files look like this: Model --- mystuff.rb class Mystuff < ActiveRecord::Base set_table_name "mytable" set_primary_key "id" end Controllers -- mystuff_controller.rb require 'Mystuff' class MystuffController

[Rails] Re: Search in database

2009-07-12 Thread heimdull
Here is a snip of my view code <% form_for(:post, :url => search_path, :html => { :method => :get }) do |f| -%> <%= text_field_tag :q, params[:q], "Enter search term(s)", :style => 'color: #999;' %> <%= f.submit("Search")%>

[Rails] Re: SVN checkout

2009-07-12 Thread heimdull
First what is this path: \Bhatta.o~>': I'm sure the problem is the special characters that you have in that path... Try renaming that directory/file... On Jul 12, 12:34 pm, Who90210 wrote: > Hello Experts, > > I'm using Svn checkout tortoise, and would like to ask for your expert > advice what

[Rails] Re: Associations - Better solution?

2009-07-12 Thread Frederick Cheung
On Jul 12, 3:43 pm, pepe wrote: > When a user is retrieved for access and functionality validations, I > re-retrieve the user through the specific user class as in: >   user = User.find(...) >   # The user is found and passes validations. >   # Now I re-retrieve it through the specific user clas

[Rails] SVN checkout

2009-07-12 Thread Who90210
Hello Experts, I'm using Svn checkout tortoise, and would like to ask for your expert advice what to do if I have following error Error: Can't check path Error: 'C:\Bleach\myforum\naturecam\bgSubCode2\build\bgSubCode2.build\Debug\bgSubCode2.build\Objects-normal\i386\Bhatta.o~>': Error: The file

[Rails] Re: Associations - Better solution?

2009-07-12 Thread pepe
Thanks a lot. I'll play with it. :) Pepe On Jul 12, 11:14 am, "Älphä Blüë" wrote: > > Users: > >   id > >   category # can be either 'ADMIN', 'AUDITOR' or 'TENANT' > > > Audits: > >   id > >   auditor_id > >   tenant_id > > Looking at this original Table format you have two foreign_keys in > au

[Rails] Re: observe_field on text_field

2009-07-12 Thread JannaB
Many Thanks Bill. First, here is what shows in firebug for that partial which creates a form: Hello Janna please update your whereabouts || tell us what you're doing: 1 2//

[Rails] Re: Testing javascript

2009-07-12 Thread Frederick Cheung
On Jul 12, 8:02 pm, Jim Burgess wrote: > Hi, > > I have two select lists in my app called 'topic' and 'member'. > Based on what I select in topic, member is populated accordingly (using > java script). > eg. If I select 'subject1' in topic, member should be populated with the > values 'prof x',

[Rails] Search in database

2009-07-12 Thread christian
Hi, Im am really new to RoR and web and I need some basic help: I would like to have a text_field and a button in a view, from where I can type in a string, passing that string to the server side that iterates through my database to see if the string is within the database. The server side shoul

[Rails] Testing javascript

2009-07-12 Thread Jim Burgess
Hi, I have two select lists in my app called 'topic' and 'member'. Based on what I select in topic, member is populated accordingly (using java script). eg. If I select 'subject1' in topic, member should be populated with the values 'prof x', 'prof y' and 'prof z'. Can I test that my java script

[Rails] errors.add don't work

2009-07-12 Thread Herman Müller
Hi RoR Comnunity! I made two virtual attributes to enter date into a text_field. Here are the tbl_bank.entries: # date text_field gueltig_ab def gueltig_ab_string if gueltig_ab gueltig_ab.strftime('%d.%m.%Y') end end def gueltig_ab_string=(gueltig_ab_str) if gueltig_ab_

[Rails] Re: Ways to chart data in Rails?

2009-07-12 Thread cpr
http://github.com/derailed/ziya/tree/master is a well put together gem that wraps around http://www.maani.us/xml_charts/index.php I've been using this stuff for a couple of years and it works very well. Start with the basic features and take on the fancy stuff incrementally. -cpr On Jul 11, 2

[Rails] Re: How to check if a table is empty ?

2009-07-12 Thread Frederick Cheung
On Jul 12, 7:15 pm, Eric wrote: > On Jul 12, 10:19 am, "Älphä Blüë" > wrote: > > > > But the variable is unnecessary, and in fact, a more concise way of > > > saying the same thing would be > > > > if Model.find(:all).empty? > > > Agreed.  I was just showing that there are more ways of doing t

[Rails] Re: observe_field on text_field

2009-07-12 Thread bill walton
On Sun, 2009-07-12 at 10:09 -0700, JannaB wrote: > As for my observer_field, I don;t follow you when you say the field > doesn;t exist and will never fire. The field with id of > 'associate_inoutexplanation' does exist (what am I missing here in > what you are saying in this regard?) I have enclo

[Rails] Re: How to check if a table is empty ?

2009-07-12 Thread Eric
On Jul 12, 10:19 am, "Älphä Blüë" wrote: > > But the variable is unnecessary, and in fact, a more concise way of > > saying the same thing would be > > > if Model.find(:all).empty? > > Agreed.  I was just showing that there are more ways of doing things.  I > use your approach... > > .empty? >

[Rails] RESTful Authentication Plugin Not Found

2009-07-12 Thread Kevin Meyer
I am new to Rails, but when I try to install the REST Authentication it always says plugin not found. I've followed the instructions on GIT and I also followed along on the NETTUTS explanation. I copy and past what is shown but without success. Any ideas out there? Thanks for the help. --~--~

[Rails] Re: Models as "views" on another model

2009-07-12 Thread Matt Jones
It's not really practical to provide "access control" at the Ruby source code level. I'd hope that you're not giving your users access to run code on the server, so this is really just a UI issue. --Matt Jones On Jul 11, 6:19 pm, cnk wrote: > I would like to selectively reuse some data. I have

[Rails] Re: Error on custom_require.rb when rspec executed.

2009-07-12 Thread Matt Jones
The error is a couple steps back up the trace, in rspec's rails.rb. The problem is that you're running an old version of rspec_on_rails, which expects ApplicationController to be defined in app/controllers/ application.rb, which it isn't anymore. Upgrading to the new version of rspec_on_rails will

[Rails] Re: Filter out or not showing event records that are in the past

2009-07-12 Thread Matt Jones
Try this in your event model: named_scope :upcoming, lambda { { :conditions => ['happens_at > ?', Time.now] } } I've assumed that your scheduled date is named 'happens_at'; tweak as needed. --Matt Jones On Jul 11, 4:05 pm, kevin lee wrote: > My app shows a list of upcoming events.  Without ha

[Rails] Re: Need some help with a model query

2009-07-12 Thread Marnen Laibow-Koser
Älphä Blüë wrote: > I'm sure there's a very > simple way of pulling in schedules that I can modify to work with my > system. However, right now, a lot of my existing app is > self-realization and still in discovery mode. Then Week 3 may be unrealistic. I speak from experience with a sports

[Rails] Installing mysql with macports

2009-07-12 Thread mikej
Not sure if this is off topic, but there doesn't seem to be an obvious place to ask this question. I am trying to use MacPorts to install mysql. I have xcode 3.0 and x11 XQuartz 2.1.6 installed. $PATH: /opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/ local/bin:/usr/X11/bi Whe

[Rails] Re: How to check if a table is empty ?

2009-07-12 Thread Älphä Blüë
> But the variable is unnecessary, and in fact, a more concise way of > saying the same thing would be > > if Model.find(:all).empty? Agreed. I was just showing that there are more ways of doing things. I use your approach... .empty? .nil? .. two things I use heavily in my projects... --

[Rails] Re: Need some help with a model query

2009-07-12 Thread Älphä Blüë
Marnen Laibow-Koser wrote: > Älphä Blüë wrote: > [...] >> First, there's naming conventions to consider for each team name. Each >> website that houses schedules name their teams differently: >> >> ESPN names USC -> USC >> ncaa.org names USC -> Southern California > [...] > > Isn't there an XM

[Rails] Re: observe_field on text_field

2009-07-12 Thread JannaB
Bill, Thank you for your pointers regarding Rails-like idioms, etc. Coming from a Java background, I really want to break from that and do things in the Rails manner, and I appreciate your pointing this out (things like .blank, etc.) As for my observer_field, I don;t follow you when you say the

[Rails] Re: Need some help with a model query

2009-07-12 Thread Marnen Laibow-Koser
Älphä Blüë wrote: [...] > First, there's naming conventions to consider for each team name. Each > website that houses schedules name their teams differently: > > ESPN names USC -> USC > ncaa.org names USC -> Southern California [...] Isn't there an XML feed or something that you could subscri

[Rails] Re: Migration in Multiple Database

2009-07-12 Thread Virendra Negi
Adam Ms. wrote: > Virendra Negi wrote: > >> my main rails application has a connection to two databases >> 1> main_development >> 2> secondary_development >> >> Know suppose i have to create a new migration for my secondary database >> how do i do it > > > I'll trade you! This is how you do m

[Rails] Re: Ways to chart data in Rails?

2009-07-12 Thread Sazima
Right-click the chart and you'll find Fusion Charts! http://www.fusioncharts.com/ Cheers, Sazima On Jul 12, 11:48 am, JannaB wrote: > I have found a site whose charts I would like to emulate. The cahrts > come up with a kind of smooth, animated look to them. If I go > to:https://www.pipelined

[Rails] Re: How to use Find with conditions?

2009-07-12 Thread Jitu
I like the type 2. But your example is a better candidate for named scope. like defining named scope 'active' and using like, Post.active On Jul 12, 5:37 pm, Rails List wrote: > Recently I read that the following find > > Type 1 > -- > Post.find(:first, :conditions => ['status = ? and activ

[Rails] Re: Need some help with a model query

2009-07-12 Thread Älphä Blüë
Marnen Laibow-Koser wrote: > Älphä Blüë wrote: > [...] >> I can't parse the schedules from ncaa.org so I'm having to enter every >> team's schedule by hand into the table initially. > [...] > > Why on earth can't you parse the schedules? It should not be necessary > to enter data like this man

[Rails] Re: observe_field on text_field

2009-07-12 Thread bill walton
Hi Janna, On Sun, 2009-07-12 at 07:36 -0700, JannaB wrote: > I've implemented observe_field succesfully on other controls, but > never on a text field. For whatever reason, the following partial > never executes the action specified in the url of my observe_field > below. > Does anyone see what

[Rails] Re: Unicode question - will it work?

2009-07-12 Thread Marnen Laibow-Koser
Bjoern wrote: > Hi, > > my apologies for that very basic question. I have heard from many > people that unicode worked well for them, but I have been unable to > find any definite information on how it works (with Rails). Make sure the DB encoding and the appropriate header in the generated HT

[Rails] Re: Associations - Better solution?

2009-07-12 Thread Älphä Blüë
> Users: > id > category # can be either 'ADMIN', 'AUDITOR' or 'TENANT' > > Audits: > id > auditor_id > tenant_id > Looking at this original Table format you have two foreign_keys in auditor and tenant. auditor_id matches user.id tenant_id matches user.id admin_id matches user.id >

[Rails] Re: Deployment on Dreamhost - Application Error

2009-07-12 Thread Marnen Laibow-Koser
Pepe Junty wrote: > Marnen Laibow-Koser wrote: >> Shouldn't matter. Most Rails apps are DB-neutral enough that Heroku >> should support them just fine. > > this particular app uses mysql specific features. Like what? I confess that I'm extremely hard-put to think of a mySQL feature that Post

[Rails] Re: Migration in Multiple Database

2009-07-12 Thread Marnen Laibow-Koser
Adam Ms. wrote: [...] > Your turn! How do you handle test fixtures for your second database? Test fixtures are evil. Use factories instead (I'm fond of Machinist for this). Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- Posted via http://www.ruby-forum.com/. --~--~--

[Rails] Re: Need some help with a model query

2009-07-12 Thread Marnen Laibow-Koser
Älphä Blüë wrote: [...] > I can't parse the schedules from ncaa.org so I'm having to enter every > team's schedule by hand into the table initially. [...] Why on earth can't you parse the schedules? It should not be necessary to enter data like this manually. Best, -- Marnen Laibow-Koser http

[Rails] Re: How to check if a table is empty ?

2009-07-12 Thread Marnen Laibow-Koser
Älphä Blüë wrote: > You can also assign a variable and check for an empty array: > > find_data = model.find(:all) > > if find_data == [] # empty array > # table is empty > # do something > end But the variable is unnecessary, and in fact, a more concise way of saying the same thing would b

[Rails] Re: How to check if a table is empty ?

2009-07-12 Thread Älphä Blüë
You can also assign a variable and check for an empty array: find_data = model.find(:all) if find_data == [] # empty array # table is empty # do something end -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because

[Rails] Re: Ways to chart data in Rails?

2009-07-12 Thread JannaB
I have found a site whose charts I would like to emulate. The cahrts come up with a kind of smooth, animated look to them. If I go to: https://www.pipelinedeals.com/ and click "thry the demo," a flash presentation of it comes up. I am wondering if anyone knows what off-the-shelf package they are u

[Rails] Associations - Better solution?

2009-07-12 Thread pepe
Hi all, I found what I think is a slick solution to a problem of mine but I'd like to know if there is a better way to accomplish what I did. I have 2 tables: Users: id category # can be either 'ADMIN', 'AUDITOR' or 'TENANT' Audits: id auditor_id tenant_id I need the audits to belon

[Rails] observe_field on text_field

2009-07-12 Thread JannaB
I've implemented observe_field succesfully on other controls, but never on a text field. For whatever reason, the following partial never executes the action specified in the url of my observe_field below. Does anyone see what I am doing wrong here and how I can make that action fire? Thanks, Jan

[Rails] Re: How to check if a table is empty ?

2009-07-12 Thread pepe
Another approach to checking for emptyness in case you need it: Table.count.zero? On Jul 10, 11:53 am, melomane wrote: > Hi > In my web application,  a table must have only one record. So when > there is no record, user can add a new row to the table, (a add link > is shown) and when a record i

[Rails] Re: Rails problem

2009-07-12 Thread Fresh Mix
Help? -- 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@googlegroups.com To unsubscribe from

[Rails] Re: Time Converstions Issues

2009-07-12 Thread Älphä Blüë
You said that you have a time object but that it holds a "string". If you are updating your mysql db with a string format of time and you specify the column as a string you can return it as a string and format it anyway you want using gsub. In either case, you can convert anything returned fr

[Rails] Re: Time Converstions Issues

2009-07-12 Thread Rick DeNatale
On Sun, Jul 12, 2009 at 6:15 AM, Frederick Cheung wrote: > > On Jul 12, 4:09 am, Josh wrote: >> >> After looking into conversions.rb. It appears that rails thinks of >> time as a datetime and this doesn't seem proper, especially when Date >> does not. Why should a random date be assigned to the t

[Rails] Re: How to use Find with conditions?

2009-07-12 Thread Colin Law
2009/7/12 Rails List : > > Recently I read that the following find > > Type 1 > -- > Post.find(:first, :conditions => ['status = ? and active = ?', 1, 1]) > > can be written as > > Type 2 > -- > Post.find(:first, :conditions => { :status => 1, :active => 1 }) > > > But how do I include LIK

[Rails] Re: DRY way of updating flash in AJAX

2009-07-12 Thread jhaagmans
In addition to this, if possible, I would like the application to know whether to execute the lines in the .rjs file or display a warning by evaluating flash[:warning]. So, if I have a form in which you can add an object, I would automatically want to do: page.insert_html :bottom, :object_list

[Rails] DRY way of updating flash in AJAX

2009-07-12 Thread jhaagmans
At this moment I'm implementing errors for my application. I have created a div for notices and warnings. The application only does AJAX requests, so it updates both flashes every time a request is made by the user. At this moment, I add a page.replace to every .rjs file at the end to update the

[Rails] Re: How to use Find with conditions?

2009-07-12 Thread Narendra sisodiya
sorry , conditions should be hash Post.find(:first,:conditions=>[ 'status like ? and active like ?', 1, 1]) On Sun, Jul 12, 2009 at 5:14 PM, Narendra sisodiya wrote: > I never used but > > this may work Post.find(:first,:conditions[ 'status like ? and active like > ?', 1, 1]) > > > On Sun, Jul

[Rails] Re: How to use Find with conditions?

2009-07-12 Thread Narendra sisodiya
I never used but this may work Post.find(:first,:conditions[ 'status like ? and active like ?', 1, 1]) On Sun, Jul 12, 2009 at 5:07 PM, Rails List < rails-mailing-l...@andreas-s.net> wrote: > > Recently I read that the following find > > Type 1 > -- > Post.find(:first, :conditions => ['statu

[Rails] How to use Find with conditions?

2009-07-12 Thread Rails List
Recently I read that the following find Type 1 -- Post.find(:first, :conditions => ['status = ? and active = ?', 1, 1]) can be written as Type 2 -- Post.find(:first, :conditions => { :status => 1, :active => 1 }) But how do I include LIKE operator in Type 2 find? thanks -- Posted vi

[Rails] Re: Rails problem

2009-07-12 Thread Fresh Mix
Frederick Cheung wrote: > I'd guess you have several versions of ruby installed. There was ruby 1.9 istalled, but not any more. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Grou

[Rails] Re: Rails problem

2009-07-12 Thread Frederick Cheung
On Jul 12, 10:17 am, Fresh Mix wrote: > ... > RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION > ... > > # ./script/generate controller test > Missing the Rails 2.3.2 gem. Please `gem install -v=2.3.2 rails`, update > your RAILS_GEM_VERSION setting in config/environment.rb for the R

[Rails] Re: Ways to chart data in Rails?

2009-07-12 Thread sclx90
Hm, honestly you could try picking up Flex -- the charting in flex is really robust and it isn't hard at all to learn. Stop at your local bookstore for a few hours on a sunday afternoon and you'll have some pretty charts come up in no time. You can pass variables into flex too from your rails code

  1   2   >