[Rails] Re: Any way to use a radio button attached to record id during a create

2011-12-23 Thread Bob Smith
On Dec 20, 3:53 am, Colin Law wrote: > On 20 December 2011 07:03, Bob Smith wrote: > > > I'm doing a list of family members, each with aradiobutton for head > > of household. After the household record and the records for each > > person are created, it is easy to set the hoh field to the person

Re: [Rails] uom gem

2011-12-23 Thread Joao Souza
Hi all, I could install as a plugin, now I need learn how to use it! Thanks Thiago and Aline, it will be very useful for me. On 24/12/11 01:04, "thiagocifani" wrote: > In your project, like anyone you have a file called gem file. Everything you > put there when you type and run bundle install

Re: [Rails] uom gem

2011-12-23 Thread thiagocifani
In your project, like anyone you have a file called gem file. Everything you put there when you type and run bundle install inside your project folder on terminal will be installed. To install this particular gem you can read the instructions on github repo. If this gem has a default installati

Re: [Rails] uom gem

2011-12-23 Thread Aline de Oliveira Freitas
I think you just need to add it to your Gemfile. Simply editing it and puting gem 'uom', and then run the bundle install command, I guess. Try this out :D 2011/12/23 Joao Souza > Hi all, > > I’m beginner with ruby and rails... I’m creating one personal project (to > learn more..) and for this

[Rails] Figured out. Thank you all for the posts

2011-12-23 Thread Jay Chaun
Thanks to Colin Law, Timothy G., Stephan Wehner, Greg Akins, Gautam Pai. Here is what I got. 1. Ajax is a bad idea for this. It will waste bandwidth and more importantly makes the character counting unreliable. You do not know when the response will be. 2. Javascript is supposed to be the tool

[Rails] Re: how to change Root_path after user sign in ?

2011-12-23 Thread Tyler Warnock
You don't necessarily have to redirect either, you can just render a different layout if you want: http://guides.rubyonrails.org/layouts_and_rendering.html On Dec 23, 10:47 am, wei jack wrote: > what i want to do is like u go to facebook. > > Before u login > > www.facebook.com, u see the welcome

[Rails] Datamapper problem "no such table"

2011-12-23 Thread Javier 12
Hi, this code used to work, but for some reason it won't now: [... load models] DataMapper.setup(:default, "mysql://cm:password@172.26.0.3/cm") DataMapper.setup(:lite, "sqlite3:///home/tigre/cm.sqlite") DataMapper.finalize DataMapper.repository(:lite).auto_migrate! DataMapper.repository(:lite) d

[Rails] uom gem

2011-12-23 Thread Joao Souza
Hi all, I¹m beginner with ruby and rails... I¹m creating one personal project (to learn more..) and for this project I need measure something using height cm and kg. I saw the uom gem ( https://github.com/madriska/uom) that I think that make this job, with ActiveRecord Integration. Could anyone, p

Re: [Rails] Re: how to change Root_path after user sign in ?

2011-12-23 Thread Dave Aronson
On Fri, Dec 23, 2011 at 13:47, wei jack wrote: > what i want to do is like u go to facebook. > Before u login > www.facebook.com, u see the welcome page. > After u login > www.facebook.com, u see the page where all friends sharing stuffs. But they're using the same URL both times. It's not a re

[Rails] Re: how to change Root_path after user sign in ?

2011-12-23 Thread wei jack
what i want to do is like u go to facebook. Before u login www.facebook.com, u see the welcome page. After u login www.facebook.com, u see the page where all friends sharing stuffs. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Go

Re: [Rails] call partial by jquery

2011-12-23 Thread Bill Walton
On Fri, Dec 23, 2011 at 12:08 PM, Bruno Meira wrote: > Ok!! > I will take a look better in these parameters. > I'm using default chrome developers js debug. Is Firebug better? > thx for the help ;D I do all my dev work in Firefox because of the tools. I hear Chrome is catching up but don't have

Re: [Rails] call partial by jquery

2011-12-23 Thread Bruno Meira
Ok!! I will take a look better in these parameters. I'm using default chrome developers js debug. Is Firebug better? thx for the help ;D -- 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

Re: [Rails] How to split a array

2011-12-23 Thread Greg Akins
On Fri, Dec 23, 2011 at 12:28 PM, honey ruby wrote: > hey everyone i want to split the array.This is the out put when i > print array "Khamar  Md,2 hrs: 5 min,Accounts,Gandhinagar" and i wanna > split them and i want to print them in different columns in a table. > <%x=Array.new%> >    <%x=@late_c

[Rails] How to split a array

2011-12-23 Thread honey ruby
hey everyone i want to split the array.This is the out put when i print array "Khamar Md,2 hrs: 5 min,Accounts,Gandhinagar" and i wanna split them and i want to print them in different columns in a table. <%x=Array.new%> <%x=@late_commers.split(",")%> <% x.each do |late_commer| %> <%= late_co

Re: [Rails] call partial by jquery

2011-12-23 Thread Bill Walton
On Fri, Dec 23, 2011 at 11:19 AM, Bill Walton wrote: > On Fri, Dec 23, 2011 at 11:12 AM, Bruno Meira wrote: >> H >> Ok, I will try do this using an ajax call... >> But How can I pass object references using an ajax call? Is it possible in >> rails or I need pass object attributes by JSON?

Re: [Rails] call partial by jquery

2011-12-23 Thread Bill Walton
On Fri, Dec 23, 2011 at 11:12 AM, Bruno Meira wrote: > H > Ok, I will try do this using an ajax call... > But How can I pass object references using an ajax call? Is it possible in > rails or I need pass object attributes by JSON? I believe that's what the 'data' argument of the .load fun

Re: [Rails] call partial by jquery

2011-12-23 Thread Bruno Meira
H Ok, I will try do this using an ajax call... But How can I pass object references using an ajax call? Is it possible in rails or I need pass object attributes by JSON? Thx :D -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To po

Re: [Rails] call partial by jquery

2011-12-23 Thread Bill Walton
HI Bruno, On Fri, Dec 23, 2011 at 11:01 AM, Bruno Meira wrote: > Hi Guys, > Sb could help me in this problem? > I have an partial that I pass some parameters... > I need to create many partials by click event of a link, How can I do that? > > I tried to do like this way > But it does'nt work... >

Re: [Rails] call partial by jquery

2011-12-23 Thread Bruno Meira
the html is similar of the inserted partial in div -- 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+uns

Re: [Rails] call partial by jquery

2011-12-23 Thread Bruno Meira
No errors appears just a pure html is inserted in div: <%=render :partial=>'shared/user_contacts',:locals=>{:f=>f},:object=>resource.user_contacts %> -- 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 rub

Re: [Rails] call partial by jquery

2011-12-23 Thread Greg Akins
On Fri, Dec 23, 2011 at 12:01 PM, Bruno Meira wrote: > Hi Guys, > Sb could help me in this problem? > I have an partial that I pass some parameters... > I need to create many partials by click event of a link, How can I do that? > > I tried to do like this way > But it does'nt work... Do you get

[Rails] call partial by jquery

2011-12-23 Thread Bruno Meira
Hi Guys, Sb could help me in this problem? I have an partial that I pass some parameters... I need to create many partials by click event of a link, How can I do that? I tried to do like this way But it does'nt work... $("#addContactLink").bind("click", function(){ $("#partialtestdiv").append("<%

[Rails] Re: COUPON CODE GENERATION

2011-12-23 Thread Satyaram B V
Hi Muruga, We did some thing similar. I have extracted the coupon code generation into a gem. You may find it at https://github.com/bvsatyaram/random_password_generator This must meet any requirement you need for coupon code generation. Let me know if you don't see a requirement met ;-) We didn'

Re: [Rails] Bypass XHR redirect by overriding redirect_to

2011-12-23 Thread Bill Walton
Hi Michael, On Thu, Dec 22, 2011 at 6:33 PM, Michael Mahemoff wrote: > A lot of calls in Rails end in a redirect_to, and this is really an > unnecessary round trip in the case of XHR calls. This might sound > crazy, but why not just handle the redirect on the server? I realize > in some cases a r

Re: [Rails] Re: how to change Root_path after user sign in ?

2011-12-23 Thread thiagocifani
I am not understanding what you want to do! You want user log in your site twice? 2011/12/23 wei jack > Gautam Pai, I think can't move authenticate_user to ProjectController > because I have other controllers actions which only registered user can > access. > > Thiagocifani, Thanks for helping

[Rails] Re: Using Thread.new in :after_save on 1.9, why not?

2011-12-23 Thread Alexey Petrushin
Yes, this make sense, but this is only one case from a lots of other possibilities. For example, we can reduce the request time by fetching user and post in parallel, like this: user, post = [ Thread.new{User.by_id request.cookies[:user_id]}, Thread.new{Post.by_id params[:id]} ].coll

[Rails] Re: How to map/reduce two MongoDB collections

2011-12-23 Thread Pravin Mishra
hi all, After continuous 10 hours work i fixed it out. below is the code which i written in challenge model. def self.task_score_map <<-MAP function() { this.tasks.forEach(function(aTask) { emit(aTask.score, {score: aTask.score}); }); } MAP end d

[Rails] Re: how to change Root_path after user sign in ?

2011-12-23 Thread wei jack
Gautam Pai, I think can't move authenticate_user to ProjectController because I have other controllers actions which only registered user can access. Thiagocifani, Thanks for helping me figure out to solve my problem. I tried. after_sign_in_path - redirect to a path after user success signed in.

Re: [Rails] Re: how to change Root_path after user sign in ?

2011-12-23 Thread thiagocifani
You could use the devise helper methods like after_update_path_for after_sign_in_path I am not sure if this is the method's name, please check the documentation for better understating. thanks follow this link https://github.com/plataformatec/devise/wiki/How-To:-Change-the-redirect-path-after

Re: [Rails] Re: how to change Root_path after user sign in ?

2011-12-23 Thread Gautam Pai
Then do root :to => welcome#index move authenticate_user! from ApplicationController to ProjectsController then when user is logged in and visits welcome#index he will be redirected to projects_url. If user is not logged in and visits projects url hel will be redirected to login page. Gautam P

Re: [Rails] http session nil

2011-12-23 Thread sachin kewale
On Fri, Dec 23, 2011 at 5:18 PM, Michael Pavling wrote: > On 23 December 2011 11:45, sachin kewale wrote: > > thanks Michael for responding,my question is how that http session is > set in > > ruby on rail ? > > because in following code '@session' is coming nil : > > > > <%if @session != nil%>

[Rails] Re: how to change Root_path after user sign in ?

2011-12-23 Thread wei jack
Follow Tim solution, Now I did. root :to => welcome#index class ApplicationController < ActionController::Base before_filter :authenticate_user!, :except[:index, :show] end In my welcome controller index def index if user_signed_in? redirect_to projects_url end end

Re: [Rails] http session nil

2011-12-23 Thread Michael Pavling
On 23 December 2011 11:45, sachin kewale wrote: > thanks Michael for responding,my question is how that http session is set in > ruby on rail ? > because in following code '@session' is coming nil : > >  <%if @session != nil%> As I said "session" is *not* an instance variable. So remove the "

Re: [Rails] http session nil

2011-12-23 Thread sachin kewale
On Fri, Dec 23, 2011 at 2:41 PM, Michael Pavling wrote: > On 23 December 2011 07:19, Gomzi Pai wrote: > > In rails session data is accessible only in controller. And thats how its > > meant to be according to MVC. > > Really... based on the evidence of all the crappy apps I keep > inheriting, th

Re: [Rails] Simple friendship table

2011-12-23 Thread Colin Law
On 21 December 2011 11:04, Fresh Mix wrote: > Tables: > Users (id, name, sex) > Friendships (user_id, friend_id, status) > > If user(1) and user(2) are friends shoud I add two rows into friendships > table? > > 1, 2, "best friends" > 2, 1, "best friends" > > Or is it enough to have one of these ro

Re: [Rails] Re: Re: ActiveRecord relation validation in Rails 3.1

2011-12-23 Thread bala kishore pulicherla
validates :item_code, :presence => true, :uniqueness => { :scope => user_id} try this way On Fri, Dec 23, 2011 at 3:32 PM, Dharmdip Rathod wrote: > Dharmdip Rathod wrote in post #1037996: > > I had already gone through. so my reply was quick. > > > > :) > > By the way, > > Thanks All for quick

[Rails] Re: Re: ActiveRecord relation validation in Rails 3.1

2011-12-23 Thread Dharmdip Rathod
Dharmdip Rathod wrote in post #1037996: > I had already gone through. so my reply was quick. > > :) By the way, Thanks All for quick reply and support. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"

[Rails] Re: Re: ActiveRecord relation validation in Rails 3.1

2011-12-23 Thread Dharmdip Rathod
I had already gone through. so my reply was quick. :) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from

SV: [Rails] Re: SV: Simple friendship table

2011-12-23 Thread Brynjolfur Thorvardsson
A simple way would be to just call .find_by_sql() On the other hand, if you create a view in MySQL to handle the query, say the view is called "friends", then you should be able to create a model like this: app/models/friend.rb class Friend < ActiveRecord::Base end Obviously, depending on the

Re: [Rails] Best Practices question

2011-12-23 Thread Colin Law
On 23 December 2011 01:32, Jeremy Rottman wrote: > This post is a two part post, I apologize for the length. > > So far I have been able to wrap my brain around RoR fairly well. But > this certain scenario, which I do plan to make use of quite a bit, has > me a little stumped. > > Currently in my

Re: [Rails] http session nil

2011-12-23 Thread Michael Pavling
On 23 December 2011 07:19, Gomzi Pai wrote: > In rails session data is accessible only in controller. And thats how its > meant to be according to MVC. Really... based on the evidence of all the crappy apps I keep inheriting, that's not correct. The session is perfectly accessible from the views

SV: [Rails] Re: SV: Simple friendship table

2011-12-23 Thread Brynjolfur Thorvardsson
It would probably run a lot faster if you had a view and separate indexes on the two uid columns. I haven't got access to my MySQL at the moment, so i can't check the syntax for creating a view but you should be able to find that yourself. Something like: CREATE VIEW friendshipview AS () Creat

Re: [Rails] Re: how to change Root_path after user sign in ?

2011-12-23 Thread Gautam Pai
Suppose you need projects#index to be visible only to logged in users. As Colin explained above, In your routes.rb put root :to => projects#index Devise provides you a method called authenticate_user! It checks if user is logged in, if not it redirects the user to login page. In the ProjectsCont

[Rails] Great Opportunity to Move to Sunny San Diego, and Lead a great team of Ruby Developers.

2011-12-23 Thread Sterling E. Dortch
learning company based in San Diego, CA that is revolutionizing the way we Learn. Our program is simple, engaging and effective. Our success owes to our team members - individually and collectively - and we are looking to bolster our roster with fresh, energetic, positive talent. We are looking for

[Rails] Best Practices question

2011-12-23 Thread Jeremy Rottman
This post is a two part post, I apologize for the length. So far I have been able to wrap my brain around RoR fairly well. But this certain scenario, which I do plan to make use of quite a bit, has me a little stumped. Currently in my application I have a view setup named dashboard.html.erb. This

[Rails] Bypass XHR redirect by overriding redirect_to

2011-12-23 Thread Michael Mahemoff
A lot of calls in Rails end in a redirect_to, and this is really an unnecessary round trip in the case of XHR calls. This might sound crazy, but why not just handle the redirect on the server? I realize in some cases a redirect will probably be better if the redirected resource is cached, but that'

[Rails] Re: how to change Root_path after user sign in ?

2011-12-23 Thread Lewisou
Are you kidding me? On Dec 23, 3:18 pm, wei jack wrote: > Thank you tim,dave,colin. > > I get it. but find difficult to implement it. > could you guy teach me how to write the function ? > I'm new to ror. > > Thanks. > > -- > Posted viahttp://www.ruby-forum.com/. -- You received this message be

Re: [Rails] Re: ActiveRecord relation validation in Rails 3.1

2011-12-23 Thread Colin Law
On 23 December 2011 07:07, Dharmdip Rathod wrote: > It's not working ! It is no good just saying it is not working, what response do you expect from that? Gautam Pai suggested that you read the documentation, but four minutes later you posted your reply so I suspect you did not do that. Go back