Re: [Rails] Rails Guide:For belongs_to associations, has_many inverse associations are ignored. not clear?

2012-11-13 Thread Paul Leader
It is useful in a small number of situations, mostly where you need to ensure that two different references to the same object actually refer to the same instance. I've only needed to use it twice, both times were where we have callbacks updating multiple related objects based on data held in

[Rails] Re: Factory girl associations and rspec

2012-11-13 Thread akalyaev
That's because users are actually different. To fix this you need to pass a user record into the FactoryGirl's create method. let(:user) {FactoryGirl.create(:user)} let(:status) {FactoryGirl.create(:status, user: user)} Regards, Anton понедельник, 12 ноября 2012 г., 14:03:19 UTC+4 пользователь

Re: [Rails] issue in delete a cookie ( cannot 'eat' it ..)

2012-11-13 Thread Erwin
[SOLVED] the issue was not with cookies .. I had to change the way I handle the session store w subdomain ... should not using domain = :all I finally set in initializers/session_store.rb Rails.application.config.session_store :active_record_store, :key = '_myapp_session', :domain = {

[Rails] how can I get the active_record_store :domain option in my controller

2012-11-13 Thread Erwin
I initialized it : Rails.application.config.session_store :active_record_store, :key = '_yoogroop_session', :domain = { production: 'yoogroop.com', development: 'lvh.me'}.fetch(Rails.env.to_param.to_sym, :all) and I need to get the :domain value in my controller cookies.delete(:login,

[Rails] best practices in methods

2012-11-13 Thread rodrigo coutinho
Hello, Consider this code, it gets a mention and an array of tags. It finds the mentions and add the tags. But in my methods I keep using return if foo.nil? or execute a line of code if a line is not nil. Is there a better way of doing this kind of thing? Thks def add_tags_to_mention

Re: [Rails] best practices in methods

2012-11-13 Thread Jordon Bedwell
On Tue, Nov 13, 2012 at 6:22 AM, rodrigo coutinho rodrigo.coutinh...@gmail.com wrote: Consider this code, it gets a mention and an array of tags. It finds the mentions and add the tags. But in my methods I keep using return if foo.nil? or execute a line of code if a line is not nil. Is there

[Rails] has many through

2012-11-13 Thread Werner
Hi all. I have models: has_many :bookings has_many :projects, :through = :bookings has_many :bookings has_many :weeks, :through = :bookings belongs_to :project belongs_to :week Now I want to get all coresponding entries from the bookings and weeks table filtered by a query.

Re: [Rails] has many through

2012-11-13 Thread Colin Law
On 13 November 2012 13:34, Werner webagentur.la...@googlemail.com wrote: Hi all. I have models: has_many :bookings has_many :projects, :through = :bookings has_many :bookings has_many :weeks, :through = :bookings belongs_to :project belongs_to :week Now I want to get all

Re: [Rails] best practices in methods

2012-11-13 Thread Juan Pablo
Returning nil is a little bit ambiguous. Did the method finished correctly or a condition wasn't met? I always try to return something or throw an exception when needed. I don't know if there's a best practice for that. On Tue 13 Nov 2012 10:24:00 AM ART, Jordon Bedwell wrote: On Tue, Nov

Re: [Rails] best practices in methods

2012-11-13 Thread rodrigo coutinho
Alright, based on your opinion of returning nil,I changed the method a little bit. In fact return false is better. Thank you. class Mention def self.build_and_save_tags mention_id, *tags mention = Mention.find mention_id return false if mention.blank? tags.each do |tag_id| tag = Tag.find tag_id

[Rails] Re: has many through

2012-11-13 Thread Erwin
with the project_id you get already all the corresponding bookings , right ? @bookings = Booking.find_all_by_project_id(params[:id]) = [#Booking id: 1, week_id: 47, project_id: 2, hour: 4, #Booking id: 2, week_id: 48, project_id: 2, hour: 7] and you want the data associated with the week and the

[Rails] routing issue on match '/:locale'

2012-11-13 Thread Erwin
I have set match '/:locale' = welcome#home, :as = :root but it doesn't cover the default case, when user enter the domain url wo locale, http://www.myapp.com Is there any way to default it to the app default locale I18n.locale ?? thanks for feedback -- You received this message

[Rails] Re: has many through

2012-11-13 Thread Werner
Hallo Erwin. yes I want the data from week with the id 47 and 48 (in this case) Am Dienstag, 13. November 2012 15:23:02 UTC+1 schrieb Erwin: with the project_id you get already all the corresponding bookings , right ? @bookings = Booking.find_all_by_project_id(params[:id]) = [#Booking

[Rails] Re: routing issue on match '/:locale'

2012-11-13 Thread Werner
Hallo Erwin.. When you work with before_filter :set_locale def set_locale # update sessions if passed session[:locale] = params[:locale] if params[:locale] # set locale based on sessions or default I18n.locale = session[:locale] || I18n.default_locale end just create

[Rails] Re: routing issue on match '/:locale'

2012-11-13 Thread Werner
root :to = 'welcome#index' is enough Am Dienstag, 13. November 2012 15:37:06 UTC+1 schrieb Werner: Hallo Erwin.. When you work with before_filter :set_locale def set_locale # update sessions if passed session[:locale] = params[:locale] if params[:locale] # set locale

Re: [Rails] has many through

2012-11-13 Thread Colin Law
On 13 November 2012 13:56, Werner webagentur.la...@googlemail.com wrote: Hi Colin. Please remember to reply to the list and please don't top post, it makes it difficult to follow the thread. Insert your reply inline at appropriate points in the previous message. Thanks. 1. I ask for entries

Re: [Rails] has many through

2012-11-13 Thread Colin Law
On 13 November 2012 15:15, Colin Law clan...@googlemail.com wrote: On 13 November 2012 13:56, Werner webagentur.la...@googlemail.com wrote: Hi Colin. Please remember to reply to the list and please don't top post, it makes it difficult to follow the thread. Insert your reply inline at

[Rails] Models and erbs

2012-11-13 Thread RVince
I'm not sure how best to do this. I have a project that has Features (these are video links) that go into a homepage. It also has Events, which get displayed in a table, can be clicked on, and a page about that event displays. I'm working in an admin application for this site, a type of CMS

Re: [Rails] Models and erbs

2012-11-13 Thread Colin Law
On 13 November 2012 16:22, RVince rvinc...@hotmail.com wrote: I'm not sure how best to do this. I have a project that has Features (these are video links) that go into a homepage. It also has Events, which get displayed in a table, can be clicked on, and a page about that event displays. I'm

[Rails] Re: Models and erbs

2012-11-13 Thread RVince
Colin, no, events and features have no relationship to each other (Eventfeatures are like features, but they are a separate object here). So: Event has_many : evenfeatures and Eventfeature belongs_to: event Thanks! rvince On Tuesday, November 13, 2012 11:22:30 AM UTC-5, RVince wrote: I'm

Re: [Rails] Re: Models and erbs

2012-11-13 Thread Colin Law
On 13 November 2012 17:02, RVince rvinc...@hotmail.com wrote: Colin, no, events and features have no relationship to each other (Eventfeatures are like features, but they are a separate object here). So: Event has_many : evenfeatures and Eventfeature belongs_to: event So why were you

Re: [Rails] Re: Models and erbs

2012-11-13 Thread RVince
On Tuesday, November 13, 2012 12:16:15 PM UTC-5, Colin Law wrote: You know that if you have an event then its eventfeatures are event.eventfeatures and if you have an eventfeature then its event is eventfeature.event? Ah, it's coming back to me now, yes, you've put me on the right

[Rails] migration problem

2012-11-13 Thread roelof
Hello, I want to use username so I can log in with username. So I made this migration file : class AddDeviseToUsers ActiveRecord::Migration def self.up change_table(:users) do |t| ## Database authenticatable t.string :username,:null = false, :default =

Re: [Rails] migration problem

2012-11-13 Thread Carlos Mathiasen
you need create_table meathod instead change_table. Matt's On Tue, Nov 13, 2012 at 3:08 PM, roelof rwob...@hotmail.com wrote: Hello, I want to use username so I can log in with username. So I made this migration file : class AddDeviseToUsers ActiveRecord::Migration def self.up

[Rails] Re: Connecting rails to a semantic RDF web database?

2012-11-13 Thread Chuck H.
I know it's been several months since your post, but I hope I can still pick your brain on the topic: I'm curious as to why you are trying to use a Rails server for this task as opposed to a Java-based server since your starting point is Jena? Have you explored other interfaces to your semantic

Re: [Rails] Re: Models and erbs

2012-11-13 Thread Colin Law
On 13 November 2012 17:30, RVince rvinc...@hotmail.com wrote: On Tuesday, November 13, 2012 12:16:15 PM UTC-5, Colin Law wrote: You know that if you have an event then its eventfeatures are event.eventfeatures and if you have an eventfeature then its event is eventfeature.event? Ah, it's

Re: [Rails] migration problem

2012-11-13 Thread Colin Law
On 13 November 2012 18:18, Carlos Mathiasen gunmath...@gmail.com wrote: you need create_table meathod instead change_table. And since the users table does not already exist you should uncomment the t.timestamps line. Colin Matt's On Tue, Nov 13, 2012 at 3:08 PM, roelof

Re: [Rails] Re: Connecting rails to a semantic RDF web database?

2012-11-13 Thread Colin Law
On 13 November 2012 19:05, Chuck H. li...@ruby-forum.com wrote: I know it's been several months since your post, but I hope I can still pick your brain on the topic: I'm curious as to why you are trying to use a Rails server for this task as opposed to a Java-based server since your starting

[Rails] Proper use of the where method om ActiveRecord.

2012-11-13 Thread byrnejb
I am trying to determine what is going on with the following code: In AR def self.all_billables where( :is_billed = false ) end returns 2 records. def self.all_billables where( is_billed = false ) end also returns 2 records. In sqlite3 sqlite select * from tests where ( is_billed =

Re: [Rails] Proper use of the where method om ActiveRecord.

2012-11-13 Thread Colin Law
On 13 November 2012 20:40, byrnejb byrn...@harte-lyne.ca wrote: I am trying to determine what is going on with the following code: In AR def self.all_billables where( :is_billed = false ) end returns 2 records. def self.all_billables where( is_billed = false ) end also returns 2

Re: [Rails] Re: Models and erbs

2012-11-13 Thread RVince
Thanks Colin, Yeah, I better do that. I'm not a newbie, BUT I haven;t been on an RoR project since 09 (just all Python and Java in the interim) and the Magic of things like ActiveRecord I have forgotten about, not to mention much of the syntax. Thanks for your help here. rvince On Tuesday,

[Rails] Re: Connecting rails to a semantic RDF web database?

2012-11-13 Thread Chuck H.
Chuck H. wrote in post #1084300: Is the other option to bypass Jena completely and use RDF.rb directly on the web layer interface? I know it's been several months since your post, but I hope I can still pick your brain on the topic: I'm curious as to why you are trying to use a Rails server

Re: [Rails] Proper use of the where method om ActiveRecord.

2012-11-13 Thread byrnejb
On Tuesday, November 13, 2012 3:45:30 PM UTC-5, Colin Law wrote: Look in log/development.log to see what the difference is in the queries (which should be logged there). Then it will probably make sense. This is the difference: (0.2ms) SELECT COUNT(*) FROM tests WHERE (is_billed =

Re: [Rails] Proper use of the where method om ActiveRecord.

2012-11-13 Thread Colin Law
On 13 November 2012 21:05, byrnejb byrn...@harte-lyne.ca wrote: On Tuesday, November 13, 2012 3:45:30 PM UTC-5, Colin Law wrote: Look in log/development.log to see what the difference is in the queries (which should be logged there). Then it will probably make sense. This is the

Re: [Rails] Proper use of the where method om ActiveRecord.

2012-11-13 Thread byrnejb
On Tuesday, November 13, 2012 4:16:17 PM UTC-5, Colin Law wrote: By using :is_billed = false you are telling rails that you want the value to be whatever rails uses as the logical value false (which appears to be f). By specifying yourself that the contents of the column must be the

[Rails] installation of queue-tip on centos/asterisk server

2012-11-13 Thread mustafa zargar
Hi Geeks, I need an urgent help with queue-tip installation. i am using http://queue-tip.rubyforge.org/install.html guide to install the same however i am stuck at first step of installation ($ rake gems:install). i installed all the dependencies mentioned in the document (ruby, rails etc.)

Re: [Rails] installation of queue-tip on centos/asterisk server

2012-11-13 Thread Colin Law
On 13 November 2012 17:36, mustafa zargar must...@almuqeet.net wrote: Hi Geeks, I need an urgent help with queue-tip installation. i am using http://queue-tip.rubyforge.org/install.html guide to install the same however i am stuck at first step of installation ($ rake gems:install). i

Re: [Rails] installation of queue-tip on centos/asterisk server

2012-11-13 Thread Norbert Melzer
Following your link reveals code at github. This code was touched the last time 4 years ago. It will not run with rails 3 or above. Am 13.11.2012 22:50 schrieb mustafa zargar must...@almuqeet.net: Hi Geeks, I need an urgent help with queue-tip installation. i am using

[Rails] Cancan question - create rule issue

2012-11-13 Thread Stan McFarland
Hi, RoR newbie here. Fairly new, anyway. :). I have a cancan question I'm hoping someone can help me with. I have two models - ProposalRequest and Proposal.Each ProposalRequest can have many Proposals, but a given user can submit only one Proposal for each ProposalRequest. I can't

[Rails] Learning RoR in 26 days: Can it be done?

2012-11-13 Thread Tom Geoco
I've recently started a challenge to learn Ruby on Rails in 26 days. I'm on day five, and I've been getting a lot of support. So I decided to reach out to find a Rails community that would be interested in giving me some feedback on my progress, and this forum seems like a pretty good place to

[Rails] startonrails do feriadão

2012-11-13 Thread Fernando Kosh
Caros, Vamos ter start amanhã? Quem confirma? [ ]'s, Fernando Kosh [:koshtech] = 'http://koshtech.com' +55 21 9699-3775 / 8695-9776 -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to

[Rails] right click or Context Menu in ruby without javascript

2012-11-13 Thread nikhil rn
Hi, This query is a replica of the link http://railsforum.com/viewtopic.php?id=51231. As I was unable to get any replies from the rails forum, I am posting the same here. I have developed an app using Rails 3. I have a table made to look like a calendar. I wanted to know if there were any

Re: [Rails] right click or Context Menu in ruby without javascript

2012-11-13 Thread Norbert Melzer
That has nothing to do with rails. Also I dont believe it would be possible without Javascript in general. Am 14.11.2012 07:46 schrieb nikhil rn li...@ruby-forum.com: Hi, This query is a replica of the link http://railsforum.com/viewtopic.php?id=51231. As I was unable to get any replies