[Rails] Re: Validate field not in model?

2009-02-27 Thread Mike C
Nevermind, getter was returning a user object instead of a string. fixed. :) On Feb 26, 10:10 pm, Mike C snib...@gmail.com wrote: Ok, I did it. But in the model I have validates_presence_of, and even though the field is filled, I keep getting the blank error. On Feb 26, 9:52 pm, CFC

[Rails] Getting unique entries from models?

2009-02-27 Thread Mike C
I'm using acts_as_taggable_on and I want to get a list of unique taggings. How can I do this? In a more general sense, say that I have a Product model with attributes name and price. I have these: id: 1 Name: Juice Price: 5 id: 2 Name: Juice Price: 5 So when I do a Product.find(:all) I'll get

[Rails] Re: Validate field not in model?

2009-02-27 Thread Nilesh Kumar
Hi Mike. Can you share the code snippet for the getter and setter methods you used, thanks. On Fri, Feb 27, 2009 at 1:48 PM, Mike C snib...@gmail.com wrote: Nevermind, getter was returning a user object instead of a string. fixed. :) On Feb 26, 10:10 pm, Mike C snib...@gmail.com wrote:

[Rails] Actionwebservice for rails2.2.2 / ruby 1.8.7

2009-02-27 Thread Lin Wj
has anyone gotten action actionwebservice to work for this config ? tried instructions from http://www.texperts.com/2007/12/21/using-action-web-service-with-rails-20/ and got a activate': can't activate actionpack on server startup -- Posted via http://www.ruby-forum.com/.

[Rails] content

2009-02-27 Thread madhavi.k
hello all, how to do content moderation,content authentication and content approval for rails application ? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group,

[Rails] Re: i18n with Rails 2.1

2009-02-27 Thread Jeba Momin
Jeba Momin wrote: MaD wrote: try specifying the source: gem update rails --source=http://gems.rubyforge.org other than that try to update your rubygems. Hey...I'm trying to update rails on another m/c now...and I'm getting the same error as before: C:\Front Endgem update rails

[Rails] Rails 2.2 + Apache 2.2 + RewriteBase /app = broken

2009-02-27 Thread Ari
I'm trying to run a rails app under an alias like this: Alias /app /var/www/railsapp/public RewriteBase /app ... I am using the same configuration that has worked for the app under Rails 1, but since I upgraded it to the latest version I get: The page you were looking for doesn't exist.

[Rails] Problem with select_tag

2009-02-27 Thread pleb...@gmail.com
i create drop-down memu for organelle by using select_tag but problem is can't get value for form select_tag to database seqfeature but form.text_field ,it's work , i don't understand why? pls help me ## code for veiw.rhtm: %

[Rails] Using form_for and has_many associations with a controller in its own subdirectory

2009-02-27 Thread Matt W.
Hi, I'm trying to create a Blog in it's own subdirectory for an E-commerce site. Everything is hooked up just fine for the basic posting, but when I try to add Comments, I'm getting all sorts of headaches! I'm referring to the screencast by Ryan Bates on the rubyonrails.org site. Basically, my

[Rails] Re: Actionwebservice for rails2.2.2 / ruby 1.8.7

2009-02-27 Thread Frederick Cheung
On Feb 27, 9:07 am, Lin Wj rails-mailing-l...@andreas-s.net wrote: has anyone gotten action actionwebservice to work for this config ? tried instructions fromhttp://www.texperts.com/2007/12/21/using-action-web-service-with-rail... and got a activate': can't activate actionpack   on

[Rails] Re: Modify beginning_of_week?

2009-02-27 Thread Gavin
What's the argument that you're passing the method? Just an integer? On Feb 27, 12:58 am, Guillaume Loader rails-mailing-l...@andreas- s.net wrote: Hello everyone! Is it possible to modify this function: beginning_of_week? What I want is something like this : beginning_of_week(0) returns

[Rails] Re: rake bombs on openssl (on Ubuntu)

2009-02-27 Thread Frederick Cheung
On Feb 27, 1:55 am, Phor Gruber phorgru...@gmail.com wrote: To me, It looks like openssl.rb is missing somewhere. I assume it should be under /rho which is where I installed ruby. I'm on ubuntu-linux and I do see openssl development packages inside of my OS: $ apt-cache search libssl

[Rails] Re: authentication and user management questions

2009-02-27 Thread MaD
at least that token-problem is solved. but it's still weird, cause that session_expiry code is actually working on one of my apps. are you sure you don't have some sort of typo? (sth. like instead of ) i would debug that piece of code to see, why the session is reset. btw: 1800 sec is of course

[Rails] Re: i18n with Rails 2.1

2009-02-27 Thread MaD
http://gems.rubyforge.vm.bytemark.co.uk/gems/actionmailer-2.2.2.gem that address seems to be working. have you tried it again? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to

[Rails] Re: i18n with Rails 2.1

2009-02-27 Thread Jeba Momin
MaD wrote: http://gems.rubyforge.vm.bytemark.co.uk/gems/actionmailer-2.2.2.gem that address seems to be working. have you tried it again? Hey... It worked when I did this: C:\gem update rails --source=http://gems.rubyforge.org 'Front End' is my Rails application... When I try doing gem

[Rails] Re: Problem with select_tag

2009-02-27 Thread vimal
i guess the select tag should be represented as form.select_tag --~--~-~--~~~---~--~~ 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: Problem with select_tag

2009-02-27 Thread Thiti Panya
vimal wrote: i guess the select tag should be represented as form.select_tag thank a lot but i used it , i have error this this undefined method `select_tag' for #ActionView::Helpers::FormBuilder:0xb788a2a4 -- Posted via http://www.ruby-forum.com/.

[Rails] blacklist

2009-02-27 Thread madhavi.k
hello all, I installed blacklist plugin from the link http://github.com/watsonian/blacklist/tree/master. when start the server I am getting as below : C:\Documents and Settings\Madhavi\Desktop\madhavi_moments \madhavi_momentsruby script/server = Booting WEBrick...

[Rails] Re: Problem with select_tag

2009-02-27 Thread vimal
use it as a symbol :organelle rather than as a string organelle make sure the :organelle field is made available in ur model seqfeature --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To

[Rails] Re: blacklist

2009-02-27 Thread vimal
install the RedCloth plugin using gem --~--~-~--~~~---~--~~ 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] Re: delete all with has_many

2009-02-27 Thread Maurício Linhares
@appt_to_edit.appt_edits.destroy_all - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Fri, Feb 27, 2009 at 3:58 AM, David dly...@gmail.com wrote: Im not sure using :dependent = delete_all is correct here but I want to delete all the

[Rails] Re: blacklist

2009-02-27 Thread madhavi.k
Thank u But I couldnt fink the link for Redcloth plugin . can u suggest a link for that. On Feb 27, 3:51 pm, vimal cool.vimalsm...@gmail.com wrote: install the RedCloth plugin using gem --~--~-~--~~~---~--~~ You received this message because you are subscribed

[Rails] Re: blacklist

2009-02-27 Thread vimal
whenever u r unfamiliar with the gem try: gem search RedCloth --remote gem install Redcloth --~--~-~--~~~---~--~~ 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

[Rails] Q: find :include

2009-02-27 Thread rails.n...@gmail.com
So I have class Post ActiveRecord::Base belongs_to :user end @posts = Post.find :all, :include=:user but when I look at my logs I see this: Post Load (2.4ms) SELECT * FROM `posts` User Load (0.2ms) SELECT * FROM `users` WHERE (`users`.`id` = 1) I was expecting one

[Rails] Re: Q: find :include

2009-02-27 Thread Frederick Cheung
On 27 Feb 2009, at 11:26, rails.n...@gmail.com wrote: So I have class Post ActiveRecord::Base belongs_to :user end @posts = Post.find :all, :include=:user but when I look at my logs I see this: Post Load (2.4ms) SELECT * FROM `posts` User Load (0.2ms) SELECT *

[Rails] simple select

2009-02-27 Thread Petan Cert
Hi all, I have two models gallery and photo (has_many - belongs_to). Can I use this to find the primary photo for the given gallery? @gallery = @user.galleries @primary_photo = @gallery.photos.find_by_primary(true).first it ends with error. Thanks for any help. P. -- Posted via

[Rails] Re: Q: find :include

2009-02-27 Thread vimal
what exactly do you want to do??? for me it looks like you want all the posts for the particular user then it should be @posts = User.posts --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group.

[Rails] Re: simple select

2009-02-27 Thread Frederick Cheung
On 27 Feb 2009, at 11:31, Petan Cert wrote: Hi all, I have two models gallery and photo (has_many - belongs_to). Can I use this to find the primary photo for the given gallery? @gallery = @user.galleries @primary_photo = @gallery.photos.find_by_primary(true).first find_by_xxx returns

[Rails] Re: simple select

2009-02-27 Thread MaD
the correct call is: @primary_photo = @gallery.photos.find(:first, :conditions = {:primary = true}) or (but thats an old one and i don't know if that isn't deprecated): @primary_photo = @gallery.photos.find_first_by_primary(true) --~--~-~--~~~---~--~~ You

[Rails] Re: simple select

2009-02-27 Thread MaD
or you could add a named_scope to your photo-model: named_scope :primary, :conditions = { :primary = true } then your call could be like: @primary_photo = @gallery.photos.primary.first this should be the nicest alternative. --~--~-~--~~~---~--~~ You received

[Rails] Re: form_remote_tag

2009-02-27 Thread Adam Akhtar
can anyone 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

[Rails] Re: blacklist

2009-02-27 Thread madhavi.k
I installed Recloth successfully... Im following this link : http://github.com/watsonian/blacklist/tree/master for blacklist words... Is it necessary to write code in my application beyond this installation ??? If so guide me. Can any body help me out? Thank you On Feb 27, 4:22 pm, vimal

[Rails] Re: form_remote_tag

2009-02-27 Thread vimal
do |form| --~--~-~--~~~---~--~~ 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, send email to

[Rails] Re: blacklist

2009-02-27 Thread vimal
I haven't used blacklist either I just traced the error in ur code --- c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- RedCloth (MissingSourceFile)

[Rails] Re: Problem with select_tag

2009-02-27 Thread Sijo Kg
change like %= form.select :organelle, ([, mitochondrion, nucleomorph, plastid, mitochondrion: kinetoplast, plastid: chloroplast, plastid: apicoplast, plastid: chromoplast, plastid: cyanelle, plastid: leucoplast, plastid: protoplastid ]) % and it will submit to the create action of

[Rails] has_many :through relationship in polymorphic associations

2009-02-27 Thread Preethi Sivakumar
Hi, I'm facing an issue in polymorphic associations when i try to to :through relationship. I've three models:profile,gbluser,community profile.rb - belongs_to :node ,:polymorphic = true belongs_to :community,:class_name = community, :foreign_key =

[Rails] Re: blacklist

2009-02-27 Thread madhavi.k
Is there any links for list out the badwords in rails application? On Feb 27, 5:08 pm, vimal cool.vimalsm...@gmail.com wrote: I haven't used blacklist either I just traced the error in ur code ---

[Rails] Re: simple select

2009-02-27 Thread Petan Cert
Thx for all your suggestions, but it always ended up with this error. NoMethodError in GalleriesController#index undefined method `photos' for #Class:0x54a56dc def index @title = gallery preview @user = User.find(params[:user_id]) @gallery = @user.galleries @primary =

[Rails] Re: Q: find :include

2009-02-27 Thread rails.n...@gmail.com
what exactly do you want to do??? I just didn't want to make a new query everytime i accessed a user of a post However, Fred is right http://www.akitaonrails.com/2008/5/26/rolling-with-rails-2-1-the-first-full-tutorial-part-2 So 2 queries is ok! :) thanks guys

[Rails] Re: Problem with select_tag

2009-02-27 Thread vimal
I am a little busy for better understanding http://guides.rails.info/form_helpers.html --~--~-~--~~~---~--~~ 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

[Rails] list out

2009-02-27 Thread madhavi.k
In my application i have a column like description of type text area. I Installed Blacklist gem and Redcloth plugin(dependency) . when I entered blacklist words in text area what should it do?(in my application it does nothing) Do I need to relate the plugin or gem to my application. reply

[Rails] Re: strict XHTML compliant ajax library

2009-02-27 Thread Phlip
Lin Wj wrote: problem : i have to develope a app using ajax features and it has to run in an environment(web tv related) which is very strict about XHTML compliance. and ajax codes generated by rails doesnt seem to be compliant. (they work on normal webpages , but not in the webtv env)

[Rails] Re: simple select

2009-02-27 Thread Eifion Bedford
It looks from your code as if you're returning a list of user galleries rather than a single one, so the list you get won't have a photos method. Does your code work if you change the third line in your method to @gallery = @user.galleries.first Eifion http://asciicasts.com Twitter: @eifion

[Rails] Re: replace_html and render action?

2009-02-27 Thread Sijo Kg
So from the view where you called this def you might have used link_to_remote or some thing like that..isn't it? So add :update = contentBody to that Now in action just write render :action = 'new' Sijo -- Posted via http://www.ruby-forum.com/.

[Rails] text library

2009-02-27 Thread Benjamín Cárdenas Salamandra
hola, I need text library, but in text.rubyforge.org only appears the doc information. how i can download de library?, in rubyforge search don't find, and in google nor. anyone know? thanks in advance, Benjamín --~--~-~--~~~---~--~~ You received this message

[Rails] Re: replace_html and render action?

2009-02-27 Thread Heinz Strunk
Yep, I just figured out that :update was missing right after I posted that, 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

[Rails] Re: simple select

2009-02-27 Thread Petan Cert
Eifion Bedford wrote: It looks from your code as if you're returning a list of user galleries rather than a single one, so the list you get won't have a photos method. Does your code work if you change the third line in your method to @gallery = @user.galleries.first Yes, thats the

[Rails] Maintaining session data across multiple domains

2009-02-27 Thread Adam
I'm working on an application that can be accessed from multiple domains. I want to maintain session data across these domains, such that if a user logs in at www.domain1.com, then moves to www.domain2.com, they will still be logged in with the same account. Is this possible in Rails? Could

[Rails] Re: simple select

2009-02-27 Thread MaD
well if you want all the primary photos just use my suggested named_scope. then you can ask: @all_primary_photos = Photo.all.primary # or just Photo.primary @all_galleries = Gallery.all no loop needed. but if you want to loop, you can do that with @all_galleries.each do |gallery| #

[Rails] what / when calls create function in an ActionController ?

2009-02-27 Thread --- z...@m ---
Hi friends , i am newbie and was trying to learn rails by following a tutorial which uses attachment_fu to upload videos .! every thing was working till i edited something somewhere ! the problem is that nothing happens when i click the submit button the new.html.erb is as follows and it

[Rails] Re: what / when calls create function in an ActionController ?

2009-02-27 Thread Starr Horne
even deleting the create function , it shows no error but returns to index page when submit button clicked . it seems that this function is not called properly Have you set up your routes.rb file? SH --~--~-~--~~~---~--~~ You received this message because you

[Rails] upload file to save

2009-02-27 Thread norricorp
I am new to rails and am stuck on the above. I have used a mixture of code from the agile web dev with rails book and what I have found with google. I realise there are easier ways to do this with various plugins but I would be interested to know why my code does not work. The code runs and a

[Rails] Re: Problem with select_tag

2009-02-27 Thread thitima panyayai
thank you very much ,i can fix it -__- 2009/2/27 Sijo Kg rails-mailing-l...@andreas-s.net change like %= form.select :organelle, ([, mitochondrion, nucleomorph, plastid, mitochondrion: kinetoplast, plastid: chloroplast, plastid: apicoplast, plastid: chromoplast, plastid: cyanelle,

[Rails] Re: what / when calls create function in an ActionController ?

2009-02-27 Thread MaD
http://api.rubyonrails.com/classes/ActionView/Helpers/FormHelper.html example taken form the above link: # Note: a @person variable will have been created in the controller. # For example: @person = Person.new % form_for :person, @person, :url = { :action = create } do |f| % %=

[Rails] Wierd to_a issue...

2009-02-27 Thread Ari
When I go to save a model, I get tons of these: /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ associations/association_proxy.rb:214: warning: default `to_a' will be obsolete It looks like the warning is coming from method_missing! Even stranger: the model saves correctly in

[Rails] Re: Getting unique entries from models?

2009-02-27 Thread Robert Walker
Mike Chai wrote: I'm using acts_as_taggable_on and I want to get a list of unique taggings. How can I do this? In a more general sense, say that I have a Product model with attributes name and price. I have these: id: 1 Name: Juice Price: 5 id: 2 Name: Juice Price: 5 So when I do

[Rails] SQL search

2009-02-27 Thread Ga Ga
How I write it in rails format? Articles.find( ) SELECT *, MATCH(title, body) AGAINST('$keyword') AS score FROM articles WHERE MATCH(title, body) AGAINST('$keyword') ORDER BY score DESC -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You

[Rails] Re: SQL search

2009-02-27 Thread Rob Biedenharn
On Feb 27, 2009, at 11:29 AM, Ga Ga wrote: How I write it in rails format? Articles.find( ) SELECT *, MATCH(title, body) AGAINST('$keyword') AS score FROM articles WHERE MATCH(title, body) AGAINST('$keyword') ORDER BY score DESC Obviously, you'd have to try it yourself, but:

[Rails] Re: attachment_fu and nested model forms

2009-02-27 Thread Tim
Maybe you just omitted this, but I think your CoverImage should declare belongs_to :product Thanks for the idea Craig. Thought we were on to something there for a second but apparently not. The update seems to work just not the create. If I change the create method to this: (yes I changed

[Rails] Re: SQL search

2009-02-27 Thread Ga Ga
I get: undefined method `sanitize_sql' -- 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

[Rails] Re: Maintaining session data across multiple domains

2009-02-27 Thread Frederick Cheung
On 27 Feb 2009, at 14:24, Adam wrote: I'm working on an application that can be accessed from multiple domains. I want to maintain session data across these domains, such that if a user logs in at www.domain1.com, then moves to www.domain2.com , they will still be logged in with the same

[Rails] Re: Getting unique entries from models?

2009-02-27 Thread Mike C
Thanks for the help. That was just an example, not a good one, but I just needed to explain the problem I'm having. It had nothing to do with acts_as_taggable_on, but I might as well just directly tell my problem. I want to display all the tags that a tagger has used. However, using

[Rails] Re: list out

2009-02-27 Thread Ar Chron
Do I need to relate the plugin or gem to my application. Of course. From the README.textile: It will also work out of the box as a Ruby on Rails plugin. Just drop it in vendor/plugins and it’ll work. when I entered blacklist words in text area what should it do?(in my application it

[Rails] Table relation problems

2009-02-27 Thread Israel Guerra
Hi. I need to know if it's possible to do something like this: http://pastie.org/402205 The table game_guesses has 2 keys for team: home_key and guest_key. The problem is that a normal relation would be team has_many/has_one game_guessbut that is not the case. I just want to see the team

[Rails] Authorization system recommendations

2009-02-27 Thread Evan
Good morning. Our application has grown to the point where a more robust authorization system is needed. What Rails plugins or Ruby gems do you recommend? Our needs include: - defining multiple user roles which can use parts of the application in different ways - easy maintenance (preferably

[Rails] Re: SQL search

2009-02-27 Thread Ga Ga
Ga Ga wrote: I get: undefined method `sanitize_sql' 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

[Rails] Re: beginners question

2009-02-27 Thread ruud
hi Gavin, I inserted two observe_field calls, essentially replacing the onclick values on the radio button tags. But it turns out that only the first time a radio button is clicked, the :function of the observer is called. So if I switch back, nothing happens. It does if I reload the page. Do I

[Rails] Polymorphic association..explain the extra query ?

2009-02-27 Thread Arpit Jain
Can anyone explain to me the sql query done in the last step : http://pastie.org/402200 -- Arpit Jain --~--~-~--~~~---~--~~ 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

[Rails] Re: Regarding IDE

2009-02-27 Thread ghettoiam
I'd second/third NetBeans. I use NetBeans on all platforms mac/ubunut/ winXP and I think it's great. Particularly because of its auto- completion, built-in documentation of ruby methods and easy debugger. It really shortened the learning curve when I originally jumped into rails. On Feb 26,

[Rails] Stupid Question - Need to get a field from table...

2009-02-27 Thread Tony Tony
Hi all, I'm ashamed to ask this but I can't figure it out. Lately my brain gets more burned out by the minute. Basically I'm trying to have a shirt have up to 2 colors. I currently have this working. When I edit a shirt, I can select the primary and secondary color of a shirt. But when I want to

[Rails] Re: beginners question

2009-02-27 Thread Gavin
Hi Ruud Hmm - I've never used observe_field to call a js function, usually just for rails-ajax calls. If I were calling a js function like so, I'd normally just add :onclick = 'date_clicked(true)' to the radio buttons. There should be a way to call the js function using observe_field though

[Rails] rails array.each returning array?

2009-02-27 Thread Sergio Ruiz
i am having a problem with a current piece of code, and it seems like the result for each on an array might be the culprit. according to everything i have seen before, this should work: a = [ a, b, c ] a.each {|x| print x, -- } should produce: a -- b -- c -- but i am getting: a

[Rails] Re: rails array.each returning array?

2009-02-27 Thread Starr Horne
does anyone know where the = [a, b, c] is coming from? It's only doing that in the console, because the return value of each is the array you passed it. If you run this code outside of irb, you won't see it. SH --~--~-~--~~~---~--~~ You received this message

[Rails] Re: rails array.each returning array?

2009-02-27 Thread Maurício Linhares
What you want is map, not each (the ruby-doc is always your friend): def self.show_pending_users self.find(:all, :conditions = pending_role is not null).map {|x| #{x.login} } end - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Fri, Feb

[Rails] Re: rails array.each returning array?

2009-02-27 Thread Sergio Ruiz
Maurício Linhares wrote: What you want is map, not each (the ruby-doc is always your friend): ah! this ended up working perfectly.. thanks so much everyone... -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because

[Rails] streamlined - inset_table or membership in edit_view

2009-02-27 Thread Sergio Ruiz
for some reason, i cannot get this to work.. this is the very last piece of this entire project that is needed for completion, and it's totally stumping me.. what i have is a relationship in edit view that is showing up as a :select. i would like it to show up as an inset_table (i think.. i

[Rails] Re: SQL search

2009-02-27 Thread Rob Biedenharn
On Feb 27, 2009, at 11:42 AM, Rob Biedenharn wrote: On Feb 27, 2009, at 11:29 AM, Ga Ga wrote: How I write it in rails format? Articles.find( ) SELECT *, MATCH(title, body) AGAINST('$keyword') AS score FROM articles WHERE MATCH(title, body) AGAINST('$keyword') ORDER BY score DESC

[Rails] Re: Stupid Question - Need to get a field from table...

2009-02-27 Thread Craig Demyanovich
On Fri, Feb 27, 2009 at 1:20 PM, Tony Tony rails-mailing-l...@andreas-s.net wrote: Hi all, I'm ashamed to ask this but I can't figure it out. Lately my brain gets more burned out by the minute. Basically I'm trying to have a shirt have up to 2 colors. I currently have this working. When I

[Rails] Re: Stupid Question - Need to get a field from table...

2009-02-27 Thread Tony Tony
Ideally something like this would be great: %=h @shirt.approved_colors.color_id.name % Any ideas? I don't know why my brain is shot today. Hate it. -Tony -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you

[Rails] Re: Stupid Question - Need to get a field from table...

2009-02-27 Thread Rob Biedenharn
On Feb 27, 2009, at 1:20 PM, Tony Tony wrote: Hi all, I'm ashamed to ask this but I can't figure it out. Lately my brain gets more burned out by the minute. Basically I'm trying to have a shirt have up to 2 colors. I currently have this working. When I edit a shirt, I can select the

[Rails] Re: Automatically get a list of controller names

2009-02-27 Thread jasoo24
I would recommend that you hard-code that list and also include controller names you may use in the future and reserved or restricted words. On Feb 26, 5:49 pm, Ramon Tayag ramon.ta...@gmail.com wrote: Okay, just a follow up question: is there an automatic way to make an array of all

[Rails] random DBI::DatabaseError while querying SqlServer

2009-02-27 Thread Seyit Caglar Abbasoglu
*First some background:* Application is running on a windows XP I'm currently using Ruby version 1.8.6-26 with easy installer (I couldn't manage to manually install 1.8.7) Rails version is 2.2.2 activerecord version 2.2.2, 1.15.6 activerecord-sqlserver-adapter is version 1.0.0.9250 ADO.rb version

[Rails] Re: Stupid Question - Need to get a field from table...

2009-02-27 Thread Tony Tony
Thanks for the replies! Craigs solution worked like a charm. First time I use foreign_key. I have a feeling that while this worked, the way it works (specifically having to specify foreign_key) is incorrect or rather defaults rails conventions. Is this the case? If so what can or should I

[Rails] Re: como consultar en oracle

2009-02-27 Thread pepe
Hola otra vez. A mí me funcionó perfectamente el gem, pero he estado jugando con el código y parece ser que lo he estropeado. Ahora estoy haciendo otras cosas, pero en cuanto tenga un momento (posiblemente esta noche) y lo resuelva te pongo aquí el ejemplo del código que he utilizado para ver si

[Rails] Re: como consultar en oracle

2009-02-27 Thread pepe
Creo que los SELECT que pones ahí van por buen camino, pero no soy experto en SQL y no sabría cómo hacer lo que necesitas. Creo que deberías intentar instalar el adaptador de Oracle. Te aseguro que una vez que lo tengas instalado no vas a volver a querer utilizar SQL puro y duro excepto a lo

[Rails] Re: Stupid Question - Need to get a field from table...

2009-02-27 Thread Craig Demyanovich
On Fri, Feb 27, 2009 at 2:33 PM, Tony Tony rails-mailing-l...@andreas-s.net wrote: Thanks for the replies! Craigs solution worked like a charm. Cool. First time I use foreign_key. I have a feeling that while this worked, the way it works (specifically having to specify foreign_key) is

[Rails] Regular Expression question

2009-02-27 Thread northband
Hi - I would like to use gsub() to strip decimals with trailing zeros from a string. My string looks like this: -- 19.0 / 482.600 mm -- I would like to end up with this: -- 19 / 482.6 mm -- Anyone have a regular expression that can do this? Thanks!

[Rails] Re: Modify beginning_of_week?

2009-02-27 Thread pepe
I see 2 ways you could do this 1. Re-open the class that offers the functionality and add your code to modify the behavior. I would not recommend that. I like leaving code that I didn't write as it is. 2. Create something very simple that receives the parameter you need and acts accordingly to

[Rails] Re: SQL search

2009-02-27 Thread Ga Ga
Rob Biedenharn wrote: On Feb 27, 2009, at 11:42 AM, Rob Biedenharn wrote: match_part = self.class. Rob Biedenharnhttp://agileconsultingllc.com r...@agileconsultingllc.com Sorry, if you look at the docs, sanitize_sql is a protected class method of ActiveRecord::Base Is there

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

2009-02-27 Thread ericindc
Thanks, this sounds like what I need. On Feb 22, 7:24 pm, Jeff Lewis jeff.bu...@gmail.com wrote: 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

[Rails] Re: Applying default conditions to a model's find, find_by_*

2009-02-27 Thread ericindc
Not at this point, so I'd prefer to come up with a solution using 2.2.2. On Feb 27, 12:46 am, Craig Demyanovich cdemyanov...@gmail.com wrote: If you can move to Rails 2.3, which is currently in release candidate testing, you could use default

[Rails] Re: Remove trailing zeros

2009-02-27 Thread pepe
Maybe you can convert them to integers? my_float = 2.0 my_float = my_float.to_i if my_float == my_float.to_i Pepe On Feb 27, 1:20 am, northband northb...@gmail.com wrote: Hi - I am working with floats and am wondering how I can trim the decimal and trailing zeros on my whole numbers.  For

[Rails] Re: Applying default conditions to a model's find, find_by_*

2009-02-27 Thread Maurício Linhares
At your model, override the find method: class SomeModel ActiveRecord::Base class self def find(*args) with_scope( :conditions = {:property = 'value'} ) do super(*args) end end end end - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) |

[Rails] Re: Stupid Question - Need to get a field from table...

2009-02-27 Thread Tony Tony
Craig Demyanovich wrote: Using the :foreign_key option isn't incorrect. It's there if you need to circumvent the Rails defaults for any reason. If you didn't want to use the :foreign_key option, you could use a migration to rename the color_id and color2_id columns in your shirts table to

[Rails] warning users that the site is coming down for maintenance

2009-02-27 Thread yber...@msn.com
Hi. I have a site that is currently running in alpha mode. I have warned my users that it will be bouncing up and down as I deploy updates. That said, i'd like to broadcast a real time warning to them when I am about to do so. Something along the lines of: The site will be brought down for

[Rails] Re: Remove trailing zeros

2009-02-27 Thread northband_101
Thanks - this seems easy enough. On Feb 27, 3:12 pm, pepe p...@betterrpg.com wrote: Maybe you can convert them to integers? my_float = 2.0 my_float = my_float.to_i if my_float == my_float.to_i Pepe On Feb 27, 1:20 am, northband northb...@gmail.com wrote: Hi - I am working with

[Rails] Re: Association through 2 intermediate Models

2009-02-27 Thread Tonypm
perhaps the responses could be a bit more helpful here? sol, I have done it through 2 level associations using through eg. Sites has_many :feed_entries, :through=:feeds I have tried with 3 levels, but never got it to work, ie, how do you chain the throughs. I have tried to make sure that

[Rails] Re: Remove trailing zeros

2009-02-27 Thread Matt Jones
The %g specifier to sprintf will do this automatically: %g % 1.0 = 1 %g % 1.375 = 1.375 --Matt Jones On Feb 27, 1:20 am, northband northb...@gmail.com wrote: Hi - I am working with floats and am wondering how I can trim the decimal and trailing zeros on my whole numbers.  For instance,

[Rails] Re: advise request: plugin routes with version prefix

2009-02-27 Thread Jean-Marc (M2i3.com)
Hi Raphaël, Changing the version of an API is never just about the version, the implications are more often than not pretty deep. My take on your case would be to publish your application as the version itself, not clouding each version with overly complex code to handle version specific code

[Rails] Re: rails find :conditions seems to remove extra blanks? (e.g. where description = 'x x x x x') is this a rails bug?

2009-02-27 Thread Matt Jones
The log entries get passed through .squeeze(' '), I'm guessing to make them look nicer on the log. (activerecord/lib/active_record/connection_adapters/ abstract_adapter.rb, line 189) Otherwise, I can't see anywhere in the code that's dropping the spaces. Google's formatting engine chews up

  1   2   >