[Rails] Re: difference between belongs_to and references keyword?

2010-06-03 Thread Ugis Ozols
I've written a short example about has_many, belongs_to - http://gist.github.com/425026 has_many, has_one, belongs_to deffinitions goes into model and not in scaffold. You can use "references" like this: script/generate scaffold address company:references address:text but as I mentioned in this d

[Rails] Re: Scheduled tasks in Rails: Cron + wget = Best solution?

2010-06-03 Thread Ugis Ozols
I'm using http://github.com/jmettraux/rufus-scheduler to schedule mail sending. I've added scheduling code in config/initializers dir and it's working quite well. On Jun 4, 1:12 am, Tom Ha wrote: > Hi there, > > do you agree that for having scheduled tasks in Rails, the leanest > solution is the

[Rails] Re: What kind of Ruby / Erb is allowed inside HAML's :javascript

2010-06-03 Thread Jian Lin
Jian Lin wrote: > but it seems the only thing allowed is > > :javascript > $('#aDiv').html('#{a_ruby_variable}'; correction: (missing the ending paren) :javascript $('#aDiv').html('#{a_ruby_variable}'); -- Posted via http://www.ruby-forum.com/. -- You received this message beca

[Rails] What kind of Ruby / Erb is allowed inside HAML's :javascript

2010-06-03 Thread Jian Lin
It seems that inside of HAML's :javascript filter, no Ruby code is allowed, not even a comment. So this is NOT allowed: :javascript - 1.upto(10) do |i| :javascript -# just a comment not to show to public (somebody said there is not way to hide comment like that inside a :javascript filter.

[Rails]

2010-06-03 Thread Tom Mac
Hi I would like to construct a button like Add And I used the helper button_to_remote for this like <%= button_to_remote("Add", { :url => some_url(@id), :condition => "check_valid()", :with=> "'ids='+user_ids"}, {:class => "form-button2 fixed3"} ) %>

[Rails] Re: rake gems:freeze GEM=pdf-writer not working on MAC

2010-06-03 Thread Tushar Gandhi
Hi, Here is the complete trace of error:- Can anyone help me out what is wrong with my configuration? administrators-macbook:browsercms_demo Administrator$ rake gems:freeze GEM=pdf-writer --trace (in /railsproject/bcms/browsercms_demo) DEPRECATION WARNING: Rake tasks in vendor/plugins/gemsonrail

Re: [Rails] Scheduled tasks in Rails: Cron + wget = Best solution?

2010-06-03 Thread Jeffrey L. Taylor
Quoting Tom Ha : [snip] > My additional question is: How would the cron job entry have to look > like in order to let cron "log in" (as admin for example) before calling > the action (for obvious security reasons)? This is what I have until > now: One solution is to use HTTP Basic Authentication a

[Rails] Re: Advise wanted on Ror software development and project m

2010-06-03 Thread Marnen Laibow-Koser
Marnen Laibow-Koser wrote: > Ginty wrote: > [...] >> Yep, in fact I have often wondered what I am missing wrt Gitosis or a >> paid Github account for that matter. >> >> Even for a multi-man team what do they give you that just sticking >> your master repository on your private server doesn't? Amp

[Rails] Re: Advise wanted on Ror software development and project m

2010-06-03 Thread Marnen Laibow-Koser
Ginty wrote: [...] > Yep, in fact I have often wondered what I am missing wrt Gitosis or a > paid Github account for that matter. > > Even for a multi-man team what do they give you that just sticking > your master repository on your private server doesn't? Real user accounts in your repository.

[Rails] Re: boot.rb:4:in `require

2010-06-03 Thread Pratik Sinha
Add this to your ~/.bashrc export GEM_HOME=/usr/lib/ruby1.9.1/gems/1.9.1 and do a "source ~/.bashrc 1.9.1 is the ruby version, change it according to your development environment > # rails s > /home/luc/firsttest/config/boot.rb:4:in `require': no such file to > load -- bundler (LoadError) >

[Rails] Re: user routing versus admin routing strategies?

2010-06-03 Thread Dee
Oh, and one other thought. If you are still concerned about the id in the url, in UserController#Index you could also check if the user is an admin, and if not then set params[:user_id] = current_user and then render :action => show instead of the index action. I haven't tried it in a while, but as

[Rails] Re: user routing versus admin routing strategies?

2010-06-03 Thread Dee
I see your point, but the user_id is just an arbitrary number used for the lookup of the correct user record. You could use anything, like user name (User.find_first_by_username(params[:username]) if you have the correct route set up. Or you could do the same thing with a randomly generated unique

[Rails] Re: Advise wanted on Ror software development and project m

2010-06-03 Thread Ginty
On Jun 3, 8:22 pm, Marnen Laibow-Koser wrote: > Ginty wrote: > > Just to say that on the private git server for a 1 man band, you can't > > do much better than get yourself a free dropbox account, stick your > > repository on it and then clone it to a local folder. > > > That's you backed up off

[Rails] Re: Scheduled tasks in Rails: Cron + wget = Best solution?

2010-06-03 Thread Tilde Equals
Tom, I think every scheduled task I've seen has called methods on models, not controller actions. Here are some ways I've seen it done: 1) Sometimes, for cron jobs run in production, folks will do a "{#RAILS_ROOT}/script/runner -e production 'Model.method' >> /dev/null 2>&1" 2) There's repeated_jo

[Rails] Re: Advise wanted on Ror software development and project m

2010-06-03 Thread Marnen Laibow-Koser
Ginty wrote: > Just to say that on the private git server for a 1 man band, you can't > do much better than get yourself a free dropbox account, stick your > repository on it and then clone it to a local folder. > > That's you backed up off site and you can access your 'sever' from all > your comp

[Rails] Re: rake gems:freeze GEM=pdf-writer not working on MAC

2010-06-03 Thread Matt Jones
On Jun 3, 3:47 am, Tushar Gandhi wrote: > Hi, > I am using MAC 10.6 OS. > I want to freeze the my application gems so that it will nor required to > install again when I go to production. For freezing of gems I am going > through the tutorial > "http://gemsonrails.rubyforge.org/"; > > But whenev

[Rails] Re: Advise wanted on Ror software development and project m

2010-06-03 Thread Ginty
Just to say that on the private git server for a 1 man band, you can't do much better than get yourself a free dropbox account, stick your repository on it and then clone it to a local folder. That's you backed up off site and you can access your 'sever' from all your computers. On Jun 3, 9:14 a

Re: [Rails] Scheduled tasks in Rails: Cron + wget = Best solution?

2010-06-03 Thread Greg Donald
On Thu, Jun 3, 2010 at 5:12 PM, Tom Ha wrote: > 20 * * * *  /usr/bin/wget --quiet -O - > 'http://www.mydomain.com/my_controller/my_action' Use script/runner. -- Greg Donald destiney.com | gregdonald.com -- You received this message because you are subscribed to the Google Groups "Ruby on Ra

[Rails] Re: Showing 404 page from controller in Rails 3

2010-06-03 Thread Legato
I can't raise ActiveRecord::NotFound as that's not the ORM I am using, so it is not even require'd in my project. Rendering 404.html should work, but how do I halt the action additionally? raising an Exception will prevent the rest of the action from executing, but rendering won't afaik. On Jun

Re: [Rails] problem with database still sqlite3 and i want mysql

2010-06-03 Thread Hassan Schroeder
On Wed, Jun 2, 2010 at 1:39 PM, Gerő Zoltán wrote: > I use Ubunu 10.4. I installed Ruby, Gem, than Rails. I chekcked: > rails -v -> getopt: invalid option -- 'v' (I don't understand this one, it > should be different?) Yes, it should work. > I reinstalled rails a few time, because first I forg

[Rails] Re: difference between belongs_to and references keyword?

2010-06-03 Thread Kevin Hastie
Kevin Hastie wrote: I guess what I really want is something like this: class Address< ActiveRecord::Base belongs_to :addressable, :polymorphic => true end class Business< ActiveRecord::Base has_one :address, :as => :addressable end class School < ActiveRecord::Base has_one :address, :as =>

[Rails] Re: difference between belongs_to and references keyword?

2010-06-03 Thread Kevin Hastie
Kevin Hastie wrote: > a) Am I doing this right? Apparently not. Weird. Is it because I didn't do polymorphic anywhere that Address now has a business_id, a credit_card_id and a user_id? Obviously this is no good - I'd prefer the Business table to have an address_id, etc So: e) Did I do t

[Rails] Re: Virtual/Flexible attributes on model

2010-06-03 Thread Marnen Laibow-Koser
Michael Pavling wrote: > On 3 June 2010 15:15, Andy Jeffries wrote: >> class UserAccount < ActiveRecord::Base >> serialize :meta_data, Hash >> end > > That would get it working to demo, but I *know* Really? Or do you guess? > that they're going to > want to search/filter on the attributes onc

[Rails] Scheduled tasks in Rails: Cron + wget = Best solution?

2010-06-03 Thread Tom Ha
Hi there, do you agree that for having scheduled tasks in Rails, the leanest solution is the following? - Create a controller with an action for each task - Implement the logic of the task as controller code - Set up a cron job at the OS level that uses wget to invoke the URL of this controller/a

[Rails] difference between belongs_to and references keyword?

2010-06-03 Thread Kevin Hastie
First, I am very new to ruby and rails. Searching for "references" is really tough, and so I've finally come here. I'm trying to create a scaffold. Let's say a Business and a School both can have a single Address (not shared). In a different case, an Offer has an OfferType (with just a type_id

[Rails] using rails for database migrations/installs - even if rails doesn't actually use that database

2010-06-03 Thread chewmanfoo
Guys, I think rails migrations are the bomb. My company deploys a rails web server and application server (for web services), as well as a stack of linux servers containing applications and databases. the rails app talks to a MySQL database which supports it, and rails migrations (rake db:create

[Rails] Re: Authlogic on Rails 3 with Checkbox

2010-06-03 Thread Siva Kilaru
Ivan Nastyukhin wrote: > <% form_for @user do |f| %> > <%= f.check_box :field_name_at_model(db) %> > <% end %> Hi Ivan, I didnt understand what you replied. I was unable to save the checkbox value to a database for an authentication through authlogic plugin on rails 3. Can you help me out i

[Rails] Re: Apache freezing with Passenger

2010-06-03 Thread chewmanfoo
I had a similar problem - our log read: /!\ FAILSAFE /!\ Thu Apr 29 10:55:46 -0400 2010 Status: 500 Internal Server Error Host 'coolhostname.com' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' so, that mysqladmin flush-hosts cleared up the pro

[Rails] Re: Apache freezing with Passenger

2010-06-03 Thread billv
Yes. I just asked our sysadmin. The httpd log shows that max_clients limit is reached. When we first ran into the problem, we raised it to 256, then to 500. We never have more than 2 or 3 using the server at a time, so it seems something is not closing properly. Thanks. On Jun 3, 1:30 pm, che

[Rails] Re: Apache freezing with Passenger

2010-06-03 Thread chewmanfoo
examine your error_log (/var/log/httpd/error_log?) and the production.log. What is the issue? Does it just freeze without a note in the logs? On Jun 3, 11:56 am, billv wrote: > We have a virtual server running CentOS5 and Rails 2.3.5 with Ruby > 1.8.7.  There are two lightly used rails apps in

[Rails] Re: Routes?

2010-06-03 Thread anon_comp
On Jun 3, 11:54 am, Sharagoz wrote: > So you're saying that you don't have control over the image tags that > are being generated in your views? That sounds like a bad position to > be in. I have no idea how you would go about manipulating the routing > to redirect calls to image files. What is g

[Rails] Simple Design and Testing Conference - Mumbai, India; June 26-27 2010

2010-06-03 Thread SD
http://sdtconf.com/ SDTConf is an all open space conference providing software practitioners a platform to meet face-to-face and discuss/demonstrate simple design & testing principles/approaches. No Marketing talks, no non-sense. All you get is a set of great practitioners interested in peer-to-p

[Rails] Re: Re: Ruby on Rails + Flash Application ?

2010-06-03 Thread Robert Walker
Peter De Berdt wrote: > However, my first few projects, or should I say failed experiments, > never went out to paying customers. There's no reason any customer > should pay for the inexperience of the developer, whether that's in > short term (everything taking a lot more time than needed) or in t

Re: [Rails] Re: Re: Session, memory_store & NoMethodError

2010-06-03 Thread Ivan Nastyukhin
if u store models, at session - u are wrong u should save, only ids to db, may be drafts, buts 4kb its normal for 99.8% situations Ivan Nastyukhin dieinz...@me.com On Jun 3, 2010, at 8:46 PM, Chdem Chdem wrote: > Because cookie store imply a strict size limit of 4kB.. > > > > > >

[Rails] ruby script/plugin install not working

2010-06-03 Thread pedrito rod
I have mingGW32 , and cygdrive I made a git clone . perfect I intent to use git... $ ./script/plugin install git://. it did not work, PLUGIN NOT FOUND... I used in the console C:\ Windows\system32\cmd.exe C:\ path...>.ruby script\plugin

[Rails] Apache freezing with Passenger

2010-06-03 Thread billv
We have a virtual server running CentOS5 and Rails 2.3.5 with Ruby 1.8.7. There are two lightly used rails apps in production on the server. Every so often, maybe once a month, Apache freezes. A simple service reset restores service. Has anyone else experienced such a problem? Any ideas as to

[Rails] Re: Session, memory_store & NoMethodError

2010-06-03 Thread Frederick Cheung
On Jun 3, 5:46 pm, Chdem Chdem wrote: > Because cookie store imply a strict size limit of 4kB.. > If you hitting that limit you are usually doing it wrong (database sessions can contain larger objects though) Fred > -- > Posted viahttp://www.ruby-forum.com/. -- You received this message

[Rails] Re: Re: Session, memory_store & NoMethodError

2010-06-03 Thread Chdem Chdem
Because cookie store imply a strict size limit of 4kB.. -- 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-t...@googlegroups.com. To unsubsc

Re: [Rails] Authlogic on Rails 3 with Checkbox

2010-06-03 Thread Ivan Nastyukhin
hi what is checkboxes?) mm, standart <% form_for @user do |f| %> <%= f.check_box :field_name_at_model(db) %> <% end %> Ivan Nastyukhin dieinz...@me.com On Jun 3, 2010, at 8:07 PM, Siva Kilaru wrote: > Hello guys, > > I had a quick question. Does Authlogic save the checkboxes to db.

Re: [Rails] Re: Session, memory_store & NoMethodError

2010-06-03 Thread Ivan Nastyukhin
why topic starter, not use cookie store? Ivan Nastyukhin dieinz...@me.com On Jun 3, 2010, at 8:04 PM, Frederick Cheung wrote: > > > On Jun 3, 4:39 pm, Chdem Chdem wrote: >> Ok, I have more informations : >> >> I can read the array from session if I modify my development.rb file : >> ch

[Rails] Authlogic on Rails 3 with Checkbox

2010-06-03 Thread Siva Kilaru
Hello guys, I had a quick question. Does Authlogic save the checkboxes to db. I came to know that it posts the value. Can you guys let me know how to save this in the Users db? Thanku in advance -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed

Re: [Rails] Re: Ruby on Rails + Flash Application ?

2010-06-03 Thread Peter De Berdt
On 03 Jun 2010, at 16:22, John Ivanoff wrote: The first "app" you wrote was it "perfect"? mine wasn't. We've all gotten where we are from writing code and learning best practices. Sometimes we have to just jump in and get it done. I don't like doing that, but sometimes you have to. If all I did

[Rails] Re: Session, memory_store & NoMethodError

2010-06-03 Thread Frederick Cheung
On Jun 3, 4:39 pm, Chdem Chdem wrote: > Ok, I have more informations : > > I can read the array from session if I modify my development.rb file : > change > config.cache_classes = false > TO > config.cache_classes = true > > like in production. But of course, I have to restart the server each >

[Rails] Re: Routes?

2010-06-03 Thread Sharagoz
On Jun 3, 5:40 pm, anon_comp wrote: > On Jun 3, 9:14 am, Sharagoz wrote: > Yes it does, but read the paragraphs before that to see that the > rendered page uses a normal html img call and that it occurs about 100 > times. But your suggestion is completely correct :) So you're saying that you do

[Rails] Re: Routes?

2010-06-03 Thread anon_comp
On Jun 3, 9:14 am, Sharagoz wrote: > Doesn't <%= image_tag('some_image.png') %> always produce an image tag > pointing to /images/some_image.png regardless of which view it is > being called from? Yes it does, but read the paragraphs before that to see that the rendered page uses a normal html i

[Rails] Re: Session, memory_store & NoMethodError

2010-06-03 Thread Chdem Chdem
Ok, I have more informations : I can read the array from session if I modify my development.rb file : change config.cache_classes = false TO config.cache_classes = true like in production. But of course, I have to restart the server each times I modify my code to see the results. Is it a cache

Re: [Rails] Re: Re: Return partial from a xhr request

2010-06-03 Thread Andy Jeffries
> > Out of interest, what's your problem with the above code? >> >> its crutch, for incomprehensible thing >> > > Sorry, I don't understand - could you rephrase... > > U should not insert if request.xhr? > u can create view, with build js ( show.js.erb) > and in its view call render, but with js

Re: [Rails] Re: Has many_through, how to show only unassociated fields for a category?

2010-06-03 Thread Ivan Nastyukhin
> > associatedFields = @category.fields > allFields = Field.all > > available = allFields - associatedFields Field.all :conditions => ["id not in (?)", @category.fields.all.map(&:id)] Field.where(["id not in (?)", @category.fields.all.map(&:id)]) if rails 3 Ivan Nastyukhin dieinz...@me.com

Re: [Rails] Re: Re: Return partial from a xhr request

2010-06-03 Thread Ivan Nastyukhin
>> Out of interest, what's your problem with the above code? > > its crutch, for incomprehensible thing > > Sorry, I don't understand - could you rephrase... U should not insert if request.xhr? u can create view, with build js ( show.js.erb) and in its view call render, but with js escape > T

[Rails] Re: Has many_through, how to show only unassociated fields for a category?

2010-06-03 Thread Samuel
Hi Sharagoz, thank you for your reply. However, I had already tried array subtraction once, but with no success. I tried for example: associatedFields = @category.fields allFields = Field.all available = allFields - associatedFields however it did not work. When I try: associatedFields.inspect

Re: [Rails] Re: Re: Return partial from a xhr request

2010-06-03 Thread Andy Jeffries
> > Out of interest, what's your problem with the above code? > > its crutch, for incomprehensible thing > Sorry, I don't understand - could you rephrase... > Premature optimisation is the root of all evil... > > yep, but i'm thinking, that write 1-10 LOC in js, witch will be build > partial for

Re: [Rails] Re: Re: Return partial from a xhr request

2010-06-03 Thread Ivan Nastyukhin
> Out of interest, what's your problem with the above code? its crutch, for incomprehensible thing > Premature optimisation is the root of all evil... yep, but i'm thinking, that write 1-10 LOC in js, witch will be build partial for each json element, its not optimisation, its "by default" use

Re: [Rails] Virtual/Flexible attributes on model

2010-06-03 Thread Andy Jeffries
> > > class UserAccount < ActiveRecord::Base > > serialize :meta_data, Hash > > end > > That would get it working to demo, but I *know* that they're going to > want to search/filter on the attributes once they have their hands on > them, so I'd prefer to start with a DB record per attribute that

Re: [Rails] Virtual/Flexible attributes on model

2010-06-03 Thread Ivan Nastyukhin
may be watch to documented db? something like mongodb? Ivan Nastyukhin dieinz...@me.com On Jun 3, 2010, at 6:20 PM, Michael Pavling wrote: > On 3 June 2010 15:15, Andy Jeffries wrote: >> class UserAccount < ActiveRecord::Base >> serialize :meta_data, Hash >> end > > That would get it wor

Re: [Rails] Re: Re: Return partial from a xhr request

2010-06-03 Thread Andy Jeffries
On 3 June 2010 15:17, Ivan Nastyukhin wrote: >if request.xhr? > render :partial => "whatever" > end > > if developers, from my team, write this, i curse too much for such) > If a developer from my team makes a judgement/technical direction based on incomplete facts I'd curse too much

Re: [Rails] Custom error message for authenticate_or_request_with_http_basic

2010-06-03 Thread Ivan Nastyukhin
class ApplicationController < ActionController::Base protect_from_forgery before_filter :auth protected def auth authenticate_or_request_with_http_basic do |id, password| authentificated = id == LOGIN && password == PASSWORD unless authentificated

[Rails] Re: Ruby on Rails + Flash Application ?

2010-06-03 Thread John Ivanoff
The first "app" you wrote was it "perfect"? mine wasn't. We've all gotten where we are from writing code and learning best practices. Sometimes we have to just jump in and get it done. I don't like doing that, but sometimes you have to. If all I did was read tutorials and best practices, I'd never

[Rails] Re: Ruby on Rails + Flash Application ?

2010-06-03 Thread Robert Walker
Marnen Laibow-Koser wrote: >> As I'm developing on Windows, remarks concerning Objective-C, Cocoa, >> putting Cappuccino at the same sentence.. make me think this is not >> the things for me right now even if I wanted to (wish it was).. > > Then you completely misunderstood. Cappuccino is a JavaS

Re: [Rails] Virtual/Flexible attributes on model

2010-06-03 Thread Michael Pavling
On 3 June 2010 15:15, Andy Jeffries wrote: > class UserAccount < ActiveRecord::Base > serialize :meta_data, Hash > end That would get it working to demo, but I *know* that they're going to want to search/filter on the attributes once they have their hands on them, so I'd prefer to start with a

Re: [Rails] Virtual/Flexible attributes on model

2010-06-03 Thread Ivan Nastyukhin
agree, eav, is build based on data serialization try it, if u will be required more, than simply switching to eav Ivan Nastyukhin dieinz...@me.com On Jun 3, 2010, at 6:15 PM, Andy Jeffries wrote: > On 3 June 2010 15:06, Michael Pavling wrote: > I've a requirement to put some user-managed

[Rails] Custom error message for authenticate_or_request_with_http_basic

2010-06-03 Thread Matthew Hillsborough
Hello, I'm using basic http authentication in my rails app with the following code: class ApplicationController < ActionController::Base helper :all # include all helpers, all the time before_filter :authenticate private def authenticate authenticate_or_request_

Re: [Rails] Re: Re: Return partial from a xhr request

2010-06-03 Thread Ivan Nastyukhin
>if request.xhr? > render :partial => "whatever" > end if developers, from my team, write this, i curse too much for such) > How much slower is a big thing though. If you can cache the response then it > should remove the load from Rails, if the content is small/gzipped over the >

Re: [Rails] Virtual/Flexible attributes on model

2010-06-03 Thread Andy Jeffries
On 3 June 2010 15:06, Michael Pavling wrote: > I've a requirement to put some user-managed attributes on a model. > > Essentially, I want Entity-Attribute-Value functionality - the > administrator has the ability to create "fields" on the model, and to > specify their type (datetime, string, bool

[Rails] Re: Advise wanted on Ror software development and project m

2010-06-03 Thread rubybox
Thanks for the Inputs! Using redmine now for several days and its lovely, nothing more I could wish for On May 29, 2:18 pm, Marnen Laibow-Koser wrote: > rubybox wrote: > > As a 1 man ruby on rails developer I have several ideas / concepts for > > (near) future project and 1 active project im w

Re: [Rails] Re: Re: Return partial from a xhr request

2010-06-03 Thread Andy Jeffries
> > mm, u can do it > but > 1) u should write yet anothe action at controller, its not like REST > No reason why you should... def show ...blah...blah...blah if request.xhr? render :partial => "whatever" end end > 2) its will be more slower, than render at mobile device, from json

Re: [Rails] Re: Re: Re: Return partial from a xhr request

2010-06-03 Thread Andy Jeffries
> > This is exactly what I planned to do until you said it would be better > to return json > Ivan said it would be better, not me :-) I said that it is faster/lighter weight - but not better and said I disagreed with him. Cheers, Andy -- You received this message because you are subscribed

[Rails] Virtual/Flexible attributes on model

2010-06-03 Thread Michael Pavling
I've a requirement to put some user-managed attributes on a model. Essentially, I want Entity-Attribute-Value functionality - the administrator has the ability to create "fields" on the model, and to specify their type (datetime, string, boolean, decimal, etc). Then in the regular views, those fie

[Rails] Re: Re: Ruby on Rails + Flash Application ?

2010-06-03 Thread Robert Walker
Michael Pavling wrote: > * quickly produced > * well written > * cheap price > ... then give them an option to pick which two (and they can *only* > have two) of the three they want. This is close, but the most useful variable was left out of this list. The choices are actually: 1. Time 2.

[Rails] Re: Re: Re: Return partial from a xhr request

2010-06-03 Thread Gregory Ma
Andy Jeffries wrote: > Sorry, just realised you were the OP :-) > > In particular I'd use jQuery's load method to load the URL in to an > element > (the original page's container for this section): > > http://api.jquery.com/load/ > > And from within the controller just render the partial: > >

Re: [Rails] Re: Re: Return partial from a xhr request

2010-06-03 Thread Ivan Nastyukhin
mm, u can do it but 1) u should write yet anothe action at controller, its not like REST 2) its will be more slower, than render at mobile device, from json Ivan Nastyukhin dieinz...@me.com On Jun 3, 2010, at 5:39 PM, Andy Jeffries wrote: > I'd do it as the OP requested, have a partial u

Re: [Rails] Re: Re: Return partial from a xhr request

2010-06-03 Thread Andy Jeffries
> > I'd do it as the OP requested, have a partial used in both places and > return that. > Sorry, just realised you were the OP :-) In particular I'd use jQuery's load method to load the URL in to an element (the original page's container for this section): http://api.jquery.com/load/ And from

Re: [Rails] Re: Re: Return partial from a xhr request

2010-06-03 Thread Andy Jeffries
> > > It's faster/lighter to do it that way. > > > > However, you often break DRY* as you have two sets of logic used to > > create > > markup from a dataset (one in Rails and one is JS). So I'm not sure I > > agree > > with Ivan. > > If you don't agree how would you do it? > I'd do it as the OP

[Rails] drag n drop desktop file to application as such in google

2010-06-03 Thread umamahe
Is that possible to " Drag n drop file from desktop to upload " in Ruby on rails application for example : google (gmail) drag n drop attachments same as this feature . Drag and drop functionality working but how to upload the file to the application ? through aja

Re: [Rails] Return partial from a xhr request

2010-06-03 Thread Ivan Nastyukhin
people not use rjs, its ugly Ivan Nastyukhin dieinz...@me.com On Jun 3, 2010, at 5:28 PM, Bill Walton wrote: > Hi Greg, > > On Thu, Jun 3, 2010 at 8:05 AM, Gregory Mar wrote: >> Hi, >> I am working on a mobile device dev using javascript and I use a remote >> Rails app for the backend. >>

[Rails] Re: Re: Return partial from a xhr request

2010-06-03 Thread Gregory Ma
Andy Jeffries wrote: > It's faster/lighter to do it that way. > > However, you often break DRY* as you have two sets of logic used to > create > markup from a dataset (one in Rails and one is JS). So I'm not sure I > agree > with Ivan. > Cheers, > Andy If you don't agree how would you do it? -

Re: [Rails] Return partial from a xhr request

2010-06-03 Thread Bill Walton
Hi Greg, On Thu, Jun 3, 2010 at 8:05 AM, Gregory Mar wrote: > Hi, > I am working on a mobile device dev using javascript and I use a remote > Rails app for the backend. > I query the backend using Ajax, and I would like to know if from my > controller I can return a partial in response to the aja

Re: [Rails] Re: Return partial from a xhr request

2010-06-03 Thread Ivan Nastyukhin
yes its better choise Ivan Nastyukhin dieinz...@me.com On Jun 3, 2010, at 5:18 PM, Gregory Ma wrote: > Ivan Nastyukhin wrote: >> yep u can >> >> index.js.erb >> >> and in it, render your response >> >> buts its worse idea, return json, and build dom >> >> >> Ivan Nastyukhin >> dieinz..

Re: [Rails] Re: Return partial from a xhr request

2010-06-03 Thread Andy Jeffries
> > > yep u can > > > > index.js.erb > > > > and in it, render your response > > > > buts its worse idea, return json, and build dom > > I'm not sure to understand. > You think it's better to return json and than build the dom from the > javascript? > It's faster/lighter to do it that way. Howeve

Re: [Rails] how to "float" layouts/partials so that they stay in a static position in the browser?

2010-06-03 Thread Andy Jeffries
http://tinyurl.com/253tgp8 (hint to Ivan, use http://lmgtfy.com/ - it's great for links like this :-) ) -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 3 June 2010 14:00, Ivan Na

[Rails] Error: can't find ldap.h and lber.h

2010-06-03 Thread Periyasamy Ramachandiran
Hi, When i run the command "ruby extconf.rb --with-openldap1" i am getting the error as "can't find ldap.h and lber.h use the option '--with-ldap-dir'!". How can i solve this problem please?. Thank you Periyasamy.R -- Posted via http://www.ruby-forum.com/. -- You received this message because

[Rails] Re: Return partial from a xhr request

2010-06-03 Thread Gregory Ma
Ivan Nastyukhin wrote: > yep u can > > index.js.erb > > and in it, render your response > > buts its worse idea, return json, and build dom > > > Ivan Nastyukhin > dieinz...@me.com I'm not sure to understand. You think it's better to return json and than build the dom from the javascript? --

[Rails] Re: click the address to display google map

2010-06-03 Thread Gregory Mar
Guo Yangguang wrote: > hi > My app has location for every user,i want the location to display a > little google map in a way like ajax when clicking the location? I am a > javascript and google map api idiot,can you help me? is there any > tutorial? I have looked over the goog map api,but can not

[Rails] Re: Routes?

2010-06-03 Thread Sharagoz
On Jun 2, 8:31 pm, anon_comp wrote: > I know squat about routes despite reading Agile Web Development with > Rails, two other relatively thick books, and multiple articles on the > web. I've tried many different ways to define the routes in hopes of > stumbling on the answer Doesn't <%= image_tag

Re: [Rails] Return partial from a xhr request

2010-06-03 Thread Ivan Nastyukhin
yep u can index.js.erb and in it, render your response buts its worse idea, return json, and build dom Ivan Nastyukhin dieinz...@me.com On Jun 3, 2010, at 5:05 PM, Gregory Mar wrote: > Hi, > I am working on a mobile device dev using javascript and I use a remote > Rails app for the bac

[Rails] Return partial from a xhr request

2010-06-03 Thread Gregory Mar
Hi, I am working on a mobile device dev using javascript and I use a remote Rails app for the backend. I query the backend using Ajax, and I would like to know if from my controller I can return a partial in response to the ajax request? Greg -- Posted via http://www.ruby-forum.com/. -- You rec

Re: [Rails] how to "float" layouts/partials so that they stay in a static position in the browser?

2010-06-03 Thread Ivan Nastyukhin
css + position fixed google it Ivan Nastyukhin dieinz...@me.com On Jun 3, 2010, at 4:58 PM, Lille wrote: > Hi, > > Anybody know how to "float" an element like a partial so that it stays > in the same position relative to the browser window frame? > > (My motivation: I'd like to have cert

[Rails] how to "float" layouts/partials so that they stay in a static position in the browser?

2010-06-03 Thread Lille
Hi, Anybody know how to "float" an element like a partial so that it stays in the same position relative to the browser window frame? (My motivation: I'd like to have certain elements always in view no matter where the user scrolls on the page.) Thanks, Lille -- You received this message beca

[Rails] Re: Routes?

2010-06-03 Thread anon_comp
On Jun 3, 12:48 am, Arun Srini wrote: > Can you share how you solved it? Am facing a similar situation. Sure thing. This may or may not be your situation considering that my page was an outside-program-generated .html page. If it is then all you have to do is move the page to the public folder.

Re: [Rails] Re: Ruby on Rails + Flash Application ?

2010-06-03 Thread Michael Pavling
On 3 June 2010 11:49, pepe wrote: > if you ask a boss or customer what is that > they prefer, pretty vs. working code, I can tell you that not 100 but > 200% of them will choose working. ;) Erroneous. You're not giving them all the information needed to make their choice. Sure, quick and dirty c

[Rails] Re: Has many_through, how to show only unassociated fields for a category?

2010-06-03 Thread Sharagoz
Fields.all gives you an array of all the fields in the database @category.fields gives you an array of all the fields for the given category (since you have the has_many :fields, :through => :categoryFields association) How do you get the fields that are present in the first array but not in the s

Re: [Rails] Re: Ruby on Rails + Flash Application ?

2010-06-03 Thread Andy Jeffries
> > > and if you ask a boss or customer what is that > > they prefer, pretty vs. working code, I can tell you that not 100 but > > 200% of them will choose working. ;) > > I don't give my clients that choice. They get properly designed code > that works. It's not up to the client to make technica

[Rails] Re: need to save generated pdf in public folder

2010-06-03 Thread Frederick Cheung
On Jun 3, 12:47 pm, ratnamraj varasala wrote: > hai > im ruby on rails developer, im integrating princely plugin and prince > software to my rails application > > i have generated pdf file successfully using the following code >  princely = Princely.new() > >       html_string = render_to_string

[Rails] Re: iterate binary string and sqlite3 query

2010-06-03 Thread Japmsn Japms
Frederick Cheung wrote: > On Jun 3, 4:37�am, Japmsn Japms wrote: >> � def word_to_links(word) >> � � parts, o = [], "" >> � � (word.size/3).times{ |i| parts << word[i*3,3] } > > I wouldn't rely on some or most kanjis being exactly 3 bytes in utf8 - > use the multibyte chars stuff in activesupport

[Rails] Re: Ruby on Rails + Flash Application ?

2010-06-03 Thread Marnen Laibow-Koser
pepe wrote: [...] > Very true, that's why I mentioned Rails generated JS because you don't > actually need to know JS to start using it if you let Rails generate > it for you. No! That will only land you in trouble without you knowing enough JS to get *out* of trouble. You have to understand w

Re: [Rails] Re: How to use split method?

2010-06-03 Thread Michael Pavling
On 3 June 2010 13:09, Sharagoz wrote: > On Jun 3, 1:43 pm, SushilKarwa wrote >> why does it return "75", instead of "1234". > Because 75 if the character code of the second character in the > string. Correct identification of the problem. > Use split with a bang intead (split!) if you wish to c

[Rails] need to save generated pdf in public folder

2010-06-03 Thread ratnamraj varasala
hai im ruby on rails developer, im integrating princely plugin and prince software to my rails application i have generated pdf file successfully using the following code princely = Princely.new() html_string = render_to_string(:template => 'test_methods/ visual_test/generate_report.rhtml'

[Rails] Re: Ruby on Rails + Flash Application ?

2010-06-03 Thread Marnen Laibow-Koser
TINODEV wrote: > Ok.. > > Took me a while to answer and try to figure out what direction was > suggested by each one of you.. > > Replying here in general, but referring to ideas, links and > suggestions contributed by you all, so - thanks, everyone! :) You're welcome. However, note that you se

[Rails] Re: How to use split method?

2010-06-03 Thread Sharagoz
On Jun 3, 1:43 pm, SushilKarwa wrote > why does it return "75", instead of "1234". Because 75 if the character code of the second character in the string. Use split with a bang intead (split!) if you wish to change the variable itself. -- You received this message because you are subscribed to t

Re: [Rails] How to use split method?

2010-06-03 Thread Michael Pavling
On 3 June 2010 12:43, SushilKarwa wrote: > I'm trying to use split method and here is my sample code.When I use > irb I gett following output > > irb(main):001:0> result = "OK:1234" > => "OK:1234" > irb(main):002:0> result.split(':') > => ["OK", "1234"] > irb(main):003:0> result[1] > => 75 You ne

[Rails] How to use split method?

2010-06-03 Thread SushilKarwa
I'm trying to use split method and here is my sample code.When I use irb I gett following output irb(main):001:0> result = "OK:1234" => "OK:1234" irb(main):002:0> result.split(':') => ["OK", "1234"] irb(main):003:0> result[1] => 75 I am not able to figure out when am trying to access 2nd element

  1   2   >