Re: [Rails] Best way to populate development database

2011-02-07 Thread Nikos Dimitrakopoulos
obviously :D I was just thinking that could reuse configuration in your database.yml (for credentials, database location, etc) On Tuesday, February 8, 2011 8:51:32 AM UTC+2, jim wrote: > > no rake task needed. if you have the mysqldump, use the following (assuming > the dump is dump.sql) > > mys

Re: [Rails] Re: url generator doesn't work

2011-02-07 Thread Gordon Yeong
Cool :) Good to hear. In perl, we used to pass the id of objects we want to methods (ie. search) and have a result given back. I know these days, we pass objects instead of primary ids which is cool :) Cheers:D Gordon Yeong On 8 February 2011 17:41, Jim Ruther Nill wrote: > Congratulations on

Re: [Rails] rails 3 dynamic route

2011-02-07 Thread Jim Ruther Nill
use match "products/category/:id/:name" => "products#index" the :as argument is for named_routes. if you want a named_route you can instead use match "products/category/:id/:name" => "products#index", :as => :product_category then in your views, you can use the named route product_category

Re: [Rails] HTML5 video not played in ipad

2011-02-07 Thread Conrad Taylor
On Tue, Dec 28, 2010 at 10:44 PM, dare ruby wrote: > Dear Friends, > > Am in process of building a video player rails application, which is > compatabile to Safari, ipad, iphone device. > > I have used below code to render a video and it works fine in safari. > But videos are not played in ipad a

[Rails] rails 3 dynamic route

2011-02-07 Thread Lune Lune
Hi all My problem is simple : I have a link which points on : "products/category/#{category.id}/#{category.name}" In my route, I'd like this link calls "products/index" BUT I want this URL in the browser : "products/category/#{name}" Using Rails 3 I instinctively tried : match "products/categ

Re: [Rails] Best way to populate development database

2011-02-07 Thread Jim Ruther Nill
no rake task needed. if you have the mysqldump, use the following (assuming the dump is dump.sql) mysql -u root -p database < dump.sql On Tue, Feb 8, 2011 at 2:03 PM, Nikos Dimitrakopoulos wrote: > How do you do it? Regular sql dump tool (like mysqldump) and then some rake > task for importing i

Re: [Rails] Search HABTM relationship in ActiveRecord

2011-02-07 Thread Jim Ruther Nill
Most of the time, I don't use habtm because I want complete control on the middle model. So if you're following Hendra's models, to search for a book under a category >> cat = ['Java', 'Python'] >> books = Book.where(:categories => {:name => cat}).includes(:categories).all This is assuming that a

Re: [Rails] Re: url generator doesn't work

2011-02-07 Thread Jim Ruther Nill
Congratulations on solving your problem. However, I just want to clarify one thing regarding named routes. (Just to help users reading the thread) What Hendra said isn't wrong. You can pass anything to part_url and it will be passed to the controller as params[:id]. To make our codes easier to r

[Rails] Re: HTML5 video not played in ipad

2011-02-07 Thread dare ruby
> Email me if you haven't solved it and would like more help. > > Ben Ben , didnt get the issue fixed When i try in ruby console like this, irb(main):001:0> MIME::Types.type_for("videos/big_buck_bunny.mp4").to_s => "video/vnd.objectvideo" Its not returning mp4 format, will that affect the a

[Rails] Re: How to transfer a javascript value into a symbol used in Ruby on Rails

2011-02-07 Thread Mohnish G j
Frederick Cheung wrote in post #980025: > On Feb 7, 8:17am, Mohnish G j wrote: >> [POST] >> 'defg8', 'abcd8', '2011-02-07 13:39:33', NULL) >> SQL (0.001896) COMMIT >> Redirected tohttp://localhost:3000/books/1054583410 >> Completed in 0.01805 (55 reqs/sec) | DB: 0.00376 (20%) | 302 Found >> [htt

[Rails] Re: Ruby on Rails Job Board

2011-02-07 Thread Nikos Dimitrakopoulos
This *may* be useful http://blog.nikosd.com/2008/09/ruby-rails-jobs-in-europe-usa-and.html (although it's 2 years old with some updates) On Tuesday, February 8, 2011 12:26:47 AM UTC+2, Ruby-Forum.com User wrote: > > Hi, I am wondering if you guys know of any good places to post a job for > Ruby

Re: [Rails] Best way to populate development database

2011-02-07 Thread Nikos Dimitrakopoulos
How do you do it? Regular sql dump tool (like mysqldump) and then some rake task for importing it on the development database? On Tuesday, February 8, 2011 1:42:22 AM UTC+2, paul wrote: > > Do you have your app deployed? What I do is populate development with > a recent backup of my live server e

[Rails]

2011-02-07 Thread loganathan sellappa
Hi, By attachment_fu i stored pdf file...now i want to view it through view file ,can anybody help me -- 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

Re: [Rails] Search HABTM relationship in ActiveRecord

2011-02-07 Thread Hendra Gunawan
I think the best way to implement HABTM is using midle model, it will useful for your query performance Example Model Book has_many :book_category_relations has_many :categories, :through => :book_category_relation end Model Category has_many :book_category_relations has_many :books,

[Rails] Re: url generator doesn't work

2011-02-07 Thread ct9a
hi, all, I figured out why. I was updating my source codes and i actually put another call for parts_url in my notification_mailer.rb under the model subdirectory. Lesson of the day - never call *_url within your model especially when the object does not belong to the class where the model is b

Re: [Rails] url generator doesn't work

2011-02-07 Thread Hendra Gunawan
maybe you can try this: part_url(@part.id) On Tue, Feb 8, 2011 at 8:19 AM, ct9a wrote: > hi all, > > > in my application, I am trying to send out a notification to users. > > I can call part_url(@part) from the calling method in the controller > BUT when I try to put the value of the parts_url

Re: [Rails]

2011-02-07 Thread loganathan sellappa
Thanks, i used sunspot instead of solar > -- 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 rubyonrails-talk+unsubscr

Re: [Rails]

2011-02-07 Thread loganathan sellappa
Thanks, i usen sunspot instead of solar -- 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 rubyonrails-talk+unsubscr..

[Rails] url generator doesn't work

2011-02-07 Thread ct9a
hi all, in my application, I am trying to send out a notification to users. I can call part_url(@part) from the calling method in the controller BUT when I try to put the value of the parts_url into a notification object, it fails. Here's the message: ActionController::RoutingError (part_url

Re: [Rails] Best way to populate development database

2011-02-07 Thread Paul
Do you have your app deployed? What I do is populate development with a recent backup of my live server every once in a while. That way I'm seeing what the users are (at least until it drifts). On Mon, Feb 7, 2011 at 5:51 PM, Hesham wrote: > What would be the best way to populate a development da

Re: [Rails]

2011-02-07 Thread Paul
Can you point a browser to http://127.0.0.1:8982/solr ? Normally solr is set up at 8983, do you have a typo there? Also, if you are just starting with solr, I'd recommend the rsolr gem instead. It is actively being maintained. On Mon, Feb 7, 2011 at 3:52 PM, Hassan Schroeder wrote: > On Sun, Feb

[Rails] Re: has_many :through question

2011-02-07 Thread slava
found the problem :) had to change WebsiteUser's has_many :marks to include :foreign_key => author_id class WebsiteUser < ActiveRecord::Base has_many :marks, :foreign_key => :author_id has_many :videos_marked, :through => :marks, :source => :markable, :source_type => "Video", :class_name => "

[Rails] Best way to populate development database

2011-02-07 Thread Hesham
What would be the best way to populate a development database for a Rails 3 app? I have looked at faker, but it seems that development has stopped, any other options? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group,

Re: [Rails] Ruby on Rails Job Board

2011-02-07 Thread Philip Hallstrom
> Hi, I am wondering if you guys know of any good places to post a job for > Ruby on Rails developers? Which job boards do most people use? Our jobs.rubynow.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, sen

[Rails] Ruby on Rails Job Board

2011-02-07 Thread Josh Waybill
Hi, I am wondering if you guys know of any good places to post a job for Ruby on Rails developers? Which job boards do most people use? Our current posting is at: http://jobs.github.com/companies/Digital%20Waybill -- Posted via http://www.ruby-forum.com/. -- You received this message because y

[Rails] Re: Having a problem initializing an associated table

2011-02-07 Thread James Byrne
Colin Law wrote in post #980132: > On 7 February 2011 21:06, James Byrne wrote: >> puts( current_log_entry.class ) >> puts( hash[:current_batch][:tx_batch_mtime] ) >> >> current_log_entry.tx_batch_mtime = \ # linebreak for clarity > > The \ must be the last char on the line, though I would have

Re: [Rails] AfterSave callback but only when the record is new

2011-02-07 Thread Colin Law
On 7 February 2011 21:35, Matias Fierro wrote: > I want to trigger a callback after the creation of an object. With a > after_create I have the problem that if the record crash for any > reason when save, then I have some corrupt data. So I need a callback > after_save but only when the record is

[Rails] AfterSave callback but only when the record is new

2011-02-07 Thread Matias Fierro
I want to trigger a callback after the creation of an object. With a after_create I have the problem that if the record crash for any reason when save, then I have some corrupt data. So I need a callback after_save but only when the record is new. -- You received this message because you are subs

Re: [Rails] Having a problem initializing an associated table

2011-02-07 Thread Colin Law
On 7 February 2011 21:06, James Byrne wrote: > Q.  What am I doing wrong such that tx_batch_mtime is not receiving the > value I believe that I am assigning?  At this point current_entry has > not itself been saved. > > I have this code: > > puts( "***      ***" *3 ) > >      current_log_entry = c

[Rails] Having a problem initializing an associated table

2011-02-07 Thread James Byrne
Q. What am I doing wrong such that tx_batch_mtime is not receiving the value I believe that I am assigning? At this point current_entry has not itself been saved. I have this code: puts( "*** ***" *3 ) current_log_entry = current_entry.edi_log_entries.build puts( current_log_entry.

Re: [Rails]

2011-02-07 Thread Hassan Schroeder
On Sun, Feb 6, 2011 at 9:32 PM, loganathan sellappa wrote: > Requiring REXML > Clearing index for Resume... > rake aborted! > Couldn't connect to the Solr server at http://127.0.0.1:8982/solr. undefined > method `closed?' for nil:NilClass, You need to run this with --trace and look at the stack

[Rails] Re: HABTM and has_one with STL

2011-02-07 Thread Matt Jones
On Feb 5, 10:29 am, Mike wrote: > Hi, > > I have an interesting dilemma, which is best shown through example. > Say I have Car and Part models which have a HABTM association.  In > this case though, the Part class is an STL with Wheel and > SteeringWheel as models.  Is there a way to setup the C

[Rails] [Rails3] How to localize attributes of non AR models

2011-02-07 Thread Fernando Perez
I have a Contact model that is a non activerecord model. I can use the validation thanks to Rails3, but I do not in which section of en.yml/de.yml I should localize the attributes of my Contact model. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscri

[Rails] Re: Question on attr_protected and attr_accessible

2011-02-07 Thread Fernando Perez
Do you prefer attr_protected or attr_accessible? I used to only use attr_accessible, but usually my model only has one field to be protected, so it becomes a pain to write: object.attr1 = ... object.attr2 = ... etc I am considering the use of attr_protected with tests to make sure that the pro

Re: [Rails] Newbie doubt in links and controllers

2011-02-07 Thread Frederick Cheung
On 7 Feb 2011, at 17:32, Amador Antonio Cuenca wrote: > Hi all, I've the following doubt. > > > <% if @entry.geomatics_checker_id.nil? and current_user.geomatics %> > <%= link_to @entry, :confirm => 'Are you sure?', :method => > :set_reviewer do %> Method (in this context) refers

Re: [Rails] Newbie doubt in links and controllers

2011-02-07 Thread Amador Antonio Cuenca
Ok Let's try: I want to update a especific field from a show view when I click the "Set reviewer" link (assigning the current user ID), reload the same view and see the changes. Fields: *Entry.geomatics_checker_id *User.id. I hope you can upderstand now. (Sorry for my bad english :/ ) Regards,

Re: [Rails] Newbie doubt in links and controllers

2011-02-07 Thread Colin Law
On 7 February 2011 17:32, Amador Antonio Cuenca wrote: > Hi all, I've the following doubt. > I've this controller methods: >   def set_elaborator >     @entry = Entry.find(params[:id]) >     @entry.geomatics_elaboration_id = current_user.id >     if @entry.save! This should be save, not save!. s

[Rails] Newbie doubt in links and controllers

2011-02-07 Thread Amador Antonio Cuenca
Hi all, I've the following doubt. I've this controller methods: def set_elaborator @entry = Entry.find(params[:id]) @entry.geomatics_elaboration_id = current_user.id if @entry.save! redirect_to(@entry, :notice => 'Elaborator setted successfully') end end def set_review

[Rails] Re: Json is not getting parsed

2011-02-07 Thread Chris Ledet
Sasikala P wrote in post #979753: > Hi All, > > I am displaying delicious feeds in my website. I am getting response > in json file from the delicious site. I cannot parse the response, I > am getting :406 not acceptable" error in the log file. Any help would > be much appreciated. In order to hel

[Rails] Re: Custom form error messages

2011-02-07 Thread Fernando Perez
My bad I just realized that they switched from camelCase css naming to underscores. I think Rails 3 introduced too many insignificant changes that are a pain in the butt to track. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google

[Rails] Re: Custom form error messages

2011-02-07 Thread Fernando Perez
I have a problem with my bogus fields no longer highlighted by fieldWithErrors. In the railscasts video it works, but not on my app that I am currently upgrading from 2.x to 3.0. In railscasts Ryan doesn't have to test manually if the field has an error. Anyone run into this issue? -- Posted

[Rails] Search HABTM relationship in ActiveRecord

2011-02-07 Thread miaout17
Consider the following scenario: Book has_and_belong_to_many Category. In other words, a category may have a lot of books, and a book can have more than one category. What is the best practice to query all books related to some specified categories. For example, if I have following books "From J

Re: [Rails] Re: Re: Can't change instance variable

2011-02-07 Thread Colin Law
On 7 February 2011 15:50, Kelly Pfaff wrote: > K thanks for the responses, i will do some reading on params. Didn't > know changing the value of an instance variable is this complicated. It isn't complicated, most things seem complicated till you know how and have had a bit of practice :) Colin

[Rails] Re: Re: Can't change instance variable

2011-02-07 Thread Kelly Pfaff
K thanks for the responses, i will do some reading on params. Didn't know changing the value of an instance variable is this complicated. -- 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

[Rails] Re: invalid multibyte character error

2011-02-07 Thread Fernando Perez
>From that url: http://nuclearsquid.com/writings/ruby-1-9-what-s-new-what-s-changed.html "Ruby 1.9 can now properly read source code files encoded in formats other than ASCII, as long as you declare it: # coding: utf-8" Don't tell me I have to put that in every file of my apps? -- Posted vi

Re: [Rails] Re: Can't change instance variable

2011-02-07 Thread Colin Law
On 7 February 2011 14:51, Kelly Pfaff wrote: > Frederick Cheung wrote in post #980057: > >> >> You haven't shown anywhere where you're trying to set it - if you want >> it to be set based on a parameter, you're going to have to set @grp to >> params[:something] >> > > Hm, i forgot the on_click in

[Rails] Re: Can't change instance variable

2011-02-07 Thread Kelly Pfaff
Frederick Cheung wrote in post #980057: > > You haven't shown anywhere where you're trying to set it - if you want > it to be set based on a parameter, you're going to have to set @grp to > params[:something] > Hm, i forgot the on_click in my code: <%= link_to image_tag("oranje.png", :mouseover =

[Rails] Re: invalid multibyte character error

2011-02-07 Thread Fernando Perez
I see this: $ ruby -e 'puts Encoding.find("locale")' ASCII-8BIT How to set the proper locale/encoding? -- 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 ruby

[Rails] Re: Rails App permissions?

2011-02-07 Thread Paul Bergstrom
Frederick Cheung wrote in post #980055: > On Feb 7, 12:54pm, Paul Bergstrom wrote: >> I can't start my app and I suspect permissions and ownership. What >> permissions should a Rails App have? Can I set 755 on everything or >> should it be less on some files? >> > As long as the user running the a

[Rails] Re: Nested Resources Issues

2011-02-07 Thread Hesham
PALMINFACE Forgot to add has_many :notes in my user model. On Feb 7, 5:11 pm, Hesham wrote: > I have the following in my routes file: > >  resources :users, :path => 'ronin' do >      resources :notes, :path => 'moras' >      resources :collections, :path => 'haiku' >    end > > If use  user.col

[Rails] Re: Required Ruby on Rails Developer ( Front End/ Back End ) / Boston, MA ( Immediate Interview )

2011-02-07 Thread Chandan
Hi Jay, Rates are not a problem for Right Candidate. Our Client which is in Mobile Domain, looking for Candidates who have good knowledge of ruby on Rails. It is onsite project. Job Location:- Boston, MA , USA Please mail me at - recruit...@quantronix.com or call me 2037182011 On Feb 4, 8:35 pm

[Rails] Re: Can't change instance variable

2011-02-07 Thread Frederick Cheung
On Feb 7, 2:19 pm, Kelly Pfaff wrote: > I have an instance variable @grp: > (app\controllers\zwemmers_controller.rb) > class ZwemmersController < ApplicationController > ... >   def initialize >     @grp='or1r2r3r4gggrp' >   end In general I'd be wary of overriding initialize without calling su

[Rails] Re: Rails App permissions?

2011-02-07 Thread Frederick Cheung
On Feb 7, 12:54 pm, Paul Bergstrom wrote: > I can't start my app and I suspect permissions and ownership. What > permissions should a Rails App have? Can I set 755 on everything or > should it be less on some files? > As long as the user running the app can read everything in there, and has writ

[Rails] Can't change instance variable

2011-02-07 Thread Kelly Pfaff
I have an instance variable @grp: (app\controllers\zwemmers_controller.rb) class ZwemmersController < ApplicationController ... def initialize @grp='or1r2r3r4gggrp' end attr_accessor :grp ... end When i click an image, i reload the main index page and try to change the value of the varia

[Rails] Re: invalid multibyte character error

2011-02-07 Thread Fernando Perez
Fernando Perez wrote in post #923012: > >> When I try to use multibyte characters in my rails controller I get an >> invalid multibyte characters error >> (/app/controllers/admin_controller.rb:6: invalid multibyte >> char (US-ASCII)). >> >> >> After I start the WEBrick server and go to >> http://lo

[Rails] [Rails3] How to define RAILS_ENV for rake?

2011-02-07 Thread Fernando Perez
With Rails3, it is no longer possible (well soon to be deprecated) to do: $ RAILS_ENV=test rake db:migrate So what's the new way of doing it? -- 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

[Rails] Nested Resources Issues

2011-02-07 Thread Hesham
I have the following in my routes file: resources :users, :path => 'ronin' do resources :notes, :path => 'moras' resources :collections, :path => 'haiku' end If use user.collections I get all the collections owned by the user. How ever if use user.notes I get NoMethodError: undef

[Rails] Rails App permissions?

2011-02-07 Thread Paul Bergstrom
I can't start my app and I suspect permissions and ownership. What permissions should a Rails App have? Can I set 755 on everything or should it be less on some files? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby o

[Rails] Re: Mixing a Array Object with ActiveRecord::Base Array Object

2011-02-07 Thread Frederick Cheung
On Feb 7, 9:42 am, Viren Negi wrote: > So .. > Is there a way can I Mix the "ActiveRecord::Base" method in "Array" of > superclass "Object" so that hence forth the object is suitable for any > further SQL related task Rather than calling find :all, see if you can use a named_scope (or just pla

[Rails] Re: How to transfer a javascript value into a symbol used in Ruby on Rails

2011-02-07 Thread Frederick Cheung
On Feb 7, 8:17 am, Mohnish G j wrote: > Hi Fred, > > I am really sorry for replying late.. > > In the parameters wrt the development.log for books doesn't consider > publishing_date to be as part of books. > > Have a look at this: > > Processing BooksController#create (for 127.0.0.1 at 2011-02-0

[Rails] How to send parameter from facebook app and return the same

2011-02-07 Thread Anil Bhat
I want to send user id as a parameter in my facebook app and want to return the same to keep track of the user who's connected to facebook from my app. I'm using Oauth2 methods - authorize_url and get_access_token. I tried to add parameter here but didn't work. If anyone has any idea, please share.

[Rails] Re: Problem with relative URLs and AJAX requests.

2011-02-07 Thread Kai Schlamp
Hi Dan ... sorry for the late reply. > I've gone through this same headache.  I too wanted to use a helper > but couldn't.  Have you considered using content_for in view and then > reference it in the section of the layout to generate the > javascript? Considered yes, but decided against as I wo

[Rails] Mixing a Array Object with ActiveRecord::Base Array Object

2011-02-07 Thread Viren Negi
Hello, Most of You might find this very weird but I have no way out of it I have a method that return a Array Object the method goes like this in User Model def accessible_websites if self.is_super_admin? ## if Super Admin Display all Website Website.all elsif self.is_ad

[Rails] Re: beginner question: database relationships

2011-02-07 Thread Alexander Farley
Ok, so I've discovered that user.topics.build can be done in the User edit form (in my project, not in the gem). However, I'm not sure how to save this newly built topic; normally this would be done by the topic controller catching the POST right? But in this case it's not the topic controller

[Rails] Re: when is_a? fails and a Foo isn't a Foo

2011-02-07 Thread Ryan Mohr
I think you nailed it Fred. Restarting the app with cache_classes on fixed the error. Both the Account and Node models are simple classes though, so I'm not sure where the reloading is becoming a problem. Why wouldn't simply restarting the server with cache_classes off fix something like this

[Rails] Re: beginner question: database relationships

2011-02-07 Thread Alexander Farley
Thanks for the advice, follow up questions: I'm using Devise for authentication. I think this means the controller inside the Devise gem handles user model editing. So, how does one add Topics as a nested resource for Users? I understand this normally requires three things: a) nested partial fo

[Rails] Re: How to transfer a javascript value into a symbol used in Ruby on Rails

2011-02-07 Thread Mohnish G j
Hi Fred, I am really sorry for replying late.. In the parameters wrt the development.log for books doesn't consider publishing_date to be as part of books. Have a look at this: Processing BooksController#create (for 127.0.0.1 at 2011-02-07 13:39:33) [POST] Session ID: BAh7BzoMY3NyZl9pZCIlZWI5