[Rails] Rails 3 advanced queries

2012-06-11 Thread Rashila Noushad
In one of my queries I used .where (:categories => {item_categories {:item_category_id => nil}} for 'item_category_id IS NULL'. How to write a similar query for 'item_category_id IS NOT NULL' ? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to

[Rails] Issues on rails server -d (daemon server)

2012-06-11 Thread Wenyi Huang
Hi, I'm trying to run ror server on background (i.e. the daemon server) I ran the following cmd: rails server -e production -d In the beginning, everything is OK. I can go to the first page (index page). However, when I try to query something (I build a small search engine), it does not respondi

Re: [Rails] Enumerations - Best Practivce

2012-06-11 Thread Matt Martini
Guys, Thanks for the feedback. Would these approaches still be the way to go if you had a large-ish set of data, say State names of Country Names? Matt On Jun 11, 2012, at 5:37 PM, Paul wrote: > I do it in the model, too, and also validate that nothing else can get > in that column in the da

Re: [Rails] Enumerations - Best Practivce

2012-06-11 Thread Walter Lee Davis
On Jun 11, 2012, at 5:57 PM, Matt Martini wrote: > Guys, > > Thanks for the feedback. > > Would these approaches still be the way to go if you had a large-ish set of > data, > say State names of Country Names? > That would depend on whether you needed to have related data, like this country

Re: [Rails] Enumerations - Best Practivce

2012-06-11 Thread Paul
I do it in the model, too, and also validate that nothing else can get in that column in the database: GENDERS = %w(Male Female) validates_inclusion_of :gender, :in => GENDERS On Mon, Jun 11, 2012 at 4:57 PM, Miguel Morales wrote: > Don't know what the best practice is, but the way I do it

Re: [Rails] Enumerations - Best Practivce

2012-06-11 Thread Miguel Morales
Don't know what the best practice is, but the way I do it is in the model class User < ActiveRecord::Base UserGenders = {:male => 1, :female => 2} end Then from code I just do if user.gender_id == User::UserGenders[:male] On Mon, Jun 11, 2012 at 1:45 PM, Matt Martini wrote: > Hello, > > What

Re: [Rails] Enumerations - Best Practivce

2012-06-11 Thread Walter Lee Davis
On Jun 11, 2012, at 4:45 PM, Matt Martini wrote: > Hello, > > What is the best way to to do enumerations of values that you want to use to > provide values for a field. There are many cases where you want the user to > choose from a list of values, but you really don't need a whole model to

[Rails] Enumerations - Best Practivce

2012-06-11 Thread Matt Martini
Hello, What is the best way to to do enumerations of values that you want to use to provide values for a field. There are many cases where you want the user to choose from a list of values, but you really don't need a whole model to support. Yet, it should be flexible enough to able to be cha

Re: [Rails] Re: installing ruby on rails 1.9.3 on windows 7

2012-06-11 Thread Colin Law
On 11 June 2012 20:49, nishant g. wrote: > did everything. > used the rubyracer and copied the source in my gemfile. ran the bundle > install again but no use. > > maybe i'm doing the process of adding the rubyracer wrong. > i would be very thankful if you please guide me through the process. > th

[Rails] How can I adjust this form_tag to work with a custom route?

2012-06-11 Thread AK
Rails 3.2.3 I am trying for the first time to build an app that makes heavy use of Javascript, but degrades gracefully. My setup is simple: Category HABTM Products and vice versa. I have a view that lets the user add products to a category. At the top of the view is a select box of produc

[Rails] Re: installing ruby on rails 1.9.3 on windows 7

2012-06-11 Thread nishant g.
did everything. used the rubyracer and copied the source in my gemfile. ran the bundle install again but no use. maybe i'm doing the process of adding the rubyracer wrong. i would be very thankful if you please guide me through the process. thanks. -- Posted via http://www.ruby-forum.com/. --

[Rails] Using AuthLogic

2012-06-11 Thread Felipe Pieretti Umpierre
Hello, I'm trying to use the authlogic to make my login in my app. The problem is when I change my user model. user model: class User < ActiveRecord::Base attr_accessible :crypted_password, :email, :password_salt, :persistence_token, :username acts_as_authentic end create_users migration c

Re: [Rails] installing ruby on rails 1.9.3 on windows 7

2012-06-11 Thread Michael Pavling
On 11 June 2012 19:19, nishant g. wrote: > C:\Sites\railsinstaller_demo>rails s > C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs/run > times.rb:51:in `autodetect': Could not find a JavaScript runtime. See > https://gi > thub.com/sstephenson/execjs for a list of availa

Re: [Rails] installing ruby on rails 1.9.3 on windows 7

2012-06-11 Thread Javier Quarite
Correct link https://github.com/sstephenson/execjs > -- 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

Re: [Rails] installing ruby on rails 1.9.3 on windows 7

2012-06-11 Thread Javier Quarite
You should take a look at this C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/ execjs-1.4.0/lib/execjs/run times.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable) Its always us

[Rails] installing ruby on rails 1.9.3 on windows 7

2012-06-11 Thread nishant g.
m sorry its a totally newbie question, but m really stuck. please help if possible. after installing everything required to run ruby on rails when i write the command 'rails s' in the command prompt it doesn't start the server. rather it shows : C:\Sites\railsinstaller_demo>rails s C:/RailsInstal

[Rails] Re: Active Record Querying HABTM

2012-06-11 Thread saroj s.
Solution: http://stackoverflow.com/questions/10983337/active-record-querying-rails-3-2-1 -- 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@go

Re: [Rails] Active Record Querying HABTM

2012-06-11 Thread Dave Aronson
On Mon, Jun 11, 2012 at 12:04 PM, saroj s. wrote: > I want to find out all the postings of the categories that the > volunteer is interested in. Sounds like you want a "has_many :through" relationship. -Dave --  Dave Aronson, Cleared/Remote Ruby on Rails Freelancer (NoVa/DC/Remote); see www.D

Re: [Rails] Re: if else statement

2012-06-11 Thread Dave Aronson
On Mon, Jun 11, 2012 at 5:22 AM, Michael Pavling wrote: > So you turned a Ruby two line method into a PHP 7-liner? If you prefer This could even be a one-liner... but maybe not for a beginner: def wld(me,him) [:lose, :draw, :win][(me <=> him) + 1] end :-) -Dave --  Dave Aronson, Clear

[Rails] Active Record Querying HABTM

2012-06-11 Thread saroj s.
I am new to rails and stuck on one Querying issue. Here is the situation. Model: Category class Category < ActiveRecord::Base has_and_belongs_to_many :postings has_and_belongs_to_many :volunteers end Model: Posting class Posting < ActiveRecord::Base has_and_belongs_to_many :c

[Rails] Re: filter children with acts_as_tree

2012-06-11 Thread CavalryJim
On Jun 11, 3:18 am, ibrahim hassan wrote: > Hello, > It didn't work i want to bring all roots that a children have one type > not only one root. > something like > @categories = Category.roots > but with children condition category_type => '2' > > Can you please help me with this. > > Best regar

[Rails] Re: Using activeresource for client/server model

2012-06-11 Thread Rick
On Friday, June 8, 2012 7:35:56 PM UTC-4, Ruby-Forum.com User wrote: > > Hi, > > i have a rails app running which has a DB of records. I wanted to > develop a client app which can > 1) view the records > 2) edit them > > So i have created a new rails app (for this client) and edited the mode

[Rails] Re: filter children with acts_as_tree

2012-06-11 Thread CavalryJim
On Jun 11, 3:18 am, ibrahim hassan wrote: > Hello, > It didn't work i want to bring all roots that a children have one type > not only one root. > something like > @categories = Category.roots > but with children condition category_type => '2' > > Can you please help me with this. > > Best regard

[Rails] Re: weird error in rails 2.3.5

2012-06-11 Thread Jamal Soueidan
Colin Law wrote in post #1064039: > On 11 June 2012 14:58, Jamal Soueidan wrote: >> locations/location.html.erb >> >> <%=location.name%> >> <%=location.name%><%=location.name%><%=location.name%> >> >> name attribute only outputs one time?? > > To work out what is going on in these situations it is

[Rails] Re: Re: weird error in rails 2.3.5

2012-06-11 Thread Jamal Soueidan
Colin Law wrote in post #1064044: > On 11 June 2012 15:16, Jamal Soueidan wrote: >> >> it works. > > Could you please quote the previous message so that it easier to > follow the thread. Remember this is a mailing list not a forum > (though you may be accessing it through a forum interface). > >

Re: [Rails] Re: weird error in rails 2.3.5

2012-06-11 Thread Colin Law
On 11 June 2012 15:16, Jamal Soueidan wrote: > Colin, I already tried that > > It's only outputting A and nothing else. > > but if I change to. > > <% @locations.each do |location| %> >  A <%=location.name%> B > <%=location.name%> C <%=location.name%> D <%=location.name%> E > <% end %> > > it work

[Rails] Re: weird error in rails 2.3.5

2012-06-11 Thread Jamal Soueidan
Colin, I already tried that It's only outputting A and nothing else. but if I change to. <% @locations.each do |location| %> A <%=location.name%> B <%=location.name%> C <%=location.name%> D <%=location.name%> E <% end %> it works. -- Posted via http://www.ruby-forum.com/. -- You received

Re: [Rails] weird error in rails 2.3.5

2012-06-11 Thread Colin Law
On 11 June 2012 14:58, Jamal Soueidan wrote: > Hello, > > I'm facing very simple weird error. > > in my main page main.html.erb > > <%=render(@locations) %> > > and in I try to output name twice > > locations/location.html.erb > > <%=location.name%> > <%=location.name%><%=location.name%><%=locatio

[Rails] weird error in rails 2.3.5

2012-06-11 Thread Jamal Soueidan
Hello, I'm facing very simple weird error. in my main page main.html.erb <%=render(@locations) %> and in I try to output name twice locations/location.html.erb <%=location.name%> <%=location.name%><%=location.name%><%=location.name%> name attribute only outputs one time?? I cannot figure ou

Re: [Rails] rake about > Environment staging

2012-06-11 Thread Rick
I'm not really too up on rvm but I wonder... Is it possible that your work environment, specifically the login shell that you are using to type commands in a terminal window, includes an alias for rake? Since staging is not one of the three default environments for RoR it had to be created wit

Re: [Rails] Using GOD

2012-06-11 Thread Scott Eisenberg
And it's blasphemous - could land your soul in eternal damnation. Not worth the risk. On Jun 11, 2012, at 7:54 AM, radhames brito wrote: > > Dont user god, under any circumstances, it stops monitoring without reason, > doesnt always restart the process and sometime when it does it forgets

Re: [Rails] Using GOD

2012-06-11 Thread radhames brito
Dont user god, under any circumstances, it stops monitoring without reason, doesnt always restart the process and sometime when it does it forgets to delete the pid file. I used it a month ago and all that happen on a very small app. -- You received this message because you are subscribed to the

Re: [Rails] Designin library for REST API client

2012-06-11 Thread Ahmy Yulrizka
Sorry i think there is lack of consistency in my previous message. it should be client = MyLibrary.new user: 'user', password: 'password' array_of_devices = client.devices.all -> GET /device devies = client.devices.create -> POST /device device = client.devices.get(1) -> GET /device/1 i understa

[Rails] Re: REXML::ParseException ... invalid byte sequence in UTF-8

2012-06-11 Thread Erwin
[SOLVED] found the answer here : http://yehudakatz.com/2010/05/05/ruby-1-9-encodings-a-primer-and-the-solution-for-rails/ .. I forgot to mention I am using Ruby 1.9.3 . so xml = REXML::Document.new(body.force_encoding("ISO-8859-1").encode("UTF-8")) is the right way to handle the response

[Rails] [Rails 3.2] REXML::ParseException ... invalid byte sequence in UTF-8

2012-06-11 Thread Erwin
when parsing an xml response ( UTF-8 encoding) I get a parsing error response => "\nhttp://a9.com/-/spec/opensearch/1.1/\"; xmlns:dc=\"http://purl.org/dc/ elements/1.1/\" version=\"2.0\">\n \nlink:http:// lvh.me:3000 - Google Recherche de blogs\nhttp:// www.google.com/search?q=link:http:

Re: [Rails] Re: if else statement

2012-06-11 Thread Michael Pavling
On 11 June 2012 10:19, Paul McGuane wrote: > thanks for the tips, i cleaned up the code a bit, and used some other > logic which produced this > > def win_lose_tie >    if self.for.to_i == self.against.to_i then >      :tie >    elsif self.for.to_i > self.against.to_i then >      :win >    else >

[Rails] Re: if else statement

2012-06-11 Thread Paul McGuane
thanks for the tips, i cleaned up the code a bit, and used some other logic which produced this def win_lose_tie if self.for.to_i == self.against.to_i then :tie elsif self.for.to_i > self.against.to_i then :win else :lose end end -- Posted via http://www.ruby

Re: [Rails] Designin library for REST API client

2012-06-11 Thread Colin Law
On 11 June 2012 09:14, Ahmy Yulrizka wrote: > Dear All, > > I'm trying to build a ruby library to communicate with a REST API. I'm > thinking to make it as an abstraction so it can be modular. > for example > > the API is structure as RESTful web service which is Rails like > > /devices -> list al

[Rails] Re: filter children with acts_as_tree

2012-06-11 Thread ibrahim hassan
Hello, It didn't work i want to bring all roots that a children have one type not only one root. something like @categories = Category.roots but with children condition category_type => '2' Can you please help me with this. Best regards -- Posted via http://www.ruby-forum.com/. -- You rece

[Rails] Designin library for REST API client

2012-06-11 Thread Ahmy Yulrizka
Dear All, I'm trying to build a ruby library to communicate with a REST API. I'm thinking to make it as an abstraction so it can be modular. for example the API is structure as RESTful web service which is Rails like /devices -> list all device /devices/12 -> show specific device /documents /doc

[Rails] [jobs] Ruby on Rails Developer (m/f)

2012-06-11 Thread Maximilian F.
Slashdot reader? Do you go shopping and think OOP? Do you dream of big data? Is GitHub the first thing you think of when someone says the word fork. Wimdu is an exciting, new start-up company headquartered in Berlin and one of the biggest Ruby projects in Europe. We are all about tdd/bdd. Initia

Re: [Rails] Recommend an image gallery with shopping cart

2012-06-11 Thread Ahmy Yulrizka
I would say spree http://spreecommerce.com/ Ahmy Yulrizka On Mon, Jun 11, 2012 at 12:55 AM, Pepe Sanchez wrote: > Hi all > > > Anyone can recommend a web applicaiton or a CMS to manage images and > videos that : > • Accepts payments, needs a shopping cart based on PayPal > • Mobilized, displ