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

2012-11-14 Thread Erwin
thanks , helpful Le mercredi 14 novembre 2012 13:33:12 UTC+1, Werner Laude a écrit : > > > Am 14.11.2012 um 11:42 schrieb Erwin >: > > Hi Erwin.. my be you check This. > > gem 'i18n_routing' > Gruss > > > Thanks Werner, I'm quite there .. I am working as you mentionned .. > but I don't understand

[Rails] can split form_for into two parts?

2012-11-14 Thread Soichi Ishida
Rails 3.1.3 Is it possible to split form_for block into two parts? More specifically, I want to create and save a model after filling required fields. But some of the fields are not required and unnecessary for the model. <%= form_for(@foo) do |f| %> f.field A <% end %> and form_tag updates t

Re: [Rails] Cancan question - create rule issue

2012-11-14 Thread Colin Law
On 13 November 2012 23:07, Stan McFarland wrote: > 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 o

[Rails] Re: Cancan question - create rule issue

2012-11-14 Thread Stan McFarland
I'll try. I'm not familiar with passing additional parameters to the initialize method but I'll give it a shot. Thanks for both of your help. Stan -- 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 ru

Re: [Rails] in standby for an annoying problem.

2012-11-14 Thread Colin Law
On 14 November 2012 21:07, Mauro wrote: > I have a model Reservation with reserved_from and reserve_to > attributes of type date. > I want create a scope of all reservations where Date.today is between > reserved_from and reserved_to. > In the model I've done: > > def self.today_reservation >

[Rails] in standby for an annoying problem.

2012-11-14 Thread Mauro
I have a model Reservation with reserved_from and reserve_to attributes of type date. I want create a scope of all reservations where Date.today is between reserved_from and reserved_to. In the model I've done: def self.today_reservation find_each do |res| if (Date.today).between?(res.

[Rails] 2013 Fukuoka Ruby Award Competition -Entries to be judged by Matz

2012-11-14 Thread Kazuhiro Koga
Dear Ruby Enthusiasts, The Government of Fukuoka, Japan, together with "Matz" Matsumoto, would like to invite you to enter the 2013 Fukuoka Ruby Competition. If you have developed Ruby programs within the past 12 months, this is the competition you've been waiting for. This year, in addition t

[Rails] Re: Cancan question - create rule issue

2012-11-14 Thread Ace Suares
Exactly. The Proposal hasn't been created, but you want to create a proposal for a certain proposal request. That PropsalRequest must already exist, right? Don't know how to get that into the ability model, maybe like Max did and include it in the init method? ace On Wednesday, November 14, 20

Re: [Rails] Ruby on Rails Roadmap

2012-11-14 Thread UNIXgod
Maybe providing the OP with links or online tutors on enough js to be useful for rails as to avoid the overlearning step developing in large frameworks. On Wed, Nov 7, 2012 at 9:02 AM, Luis Vasconcellos wrote: > Yes you can, but you shouldn't, you should learn some basic javascript > before you l

[Rails] Re: How to stop ruby escaping javascript?

2012-11-14 Thread Max Shytikov
Hi Only one solution you should use method 'tag' directly https://github.com/rails/rails/blob/39b9c943b7ec5181c19461d319d8c610ea1bf941/actionpack/lib/action_view/helpers/tag_helper.rb#L65 Because escape = true by default for 'text_field_tag' https://github.com/rails/rails/blob/c091fae21f32250

[Rails] Re: wrap_parameters and Single Table Inheritance

2012-11-14 Thread Max Shytikov
Hi Christopher, You can try this for example wrap_parameters Entity, :include =>(Person.attribute_names + Group. attribute_names), :format => :json On Thursday, November 8, 2012 2:07:33 AM UTC+2, Christopher Thielen wrote: > > I'm using wrap_parameters and ActiveRecord's single table inheritan

[Rails] How to stop ruby escaping javascript?

2012-11-14 Thread Sam Pei
Hi all. If In my view I have: <%= text_field_tag('name','',:onfocus => "for (var i=1;i<9;i++){};" %> I'd expect to have this html: instead I have: And obviously the javascript code does not work... I also tried this: <%= text_field_tag('name','',:onfocus => "for (var i=1;i<9;i++)

Re: [Rails] Re: non ascii encoding

2012-11-14 Thread Jim Ruther Nill
On Wed, Nov 14, 2012 at 11:21 PM, Max Shytikov wrote: > Hi Jim, Hi Max, thanks for replying. I gave > Looks that you have encoding problems, check your current encoding > > puts Encoding.default_external > > To solve your problem it should be UTF-8. Because according to the docs > http://ww

[Rails] Re: non ascii encoding

2012-11-14 Thread Max Shytikov
Hi Jim, Looks that you have encoding problems, check your current encoding puts Encoding.default_external To solve your problem it should be UTF-8. Because according to the docs http://www.ruby-doc.org/core-1.9.3/Encoding.html#method-c-default_external *"File

[Rails] devise problem : xpected /home/roelof/tamara_devise/app/controllers/sessions_controller.rb to define

2012-11-14 Thread roelof
Hello, Because I want to change something on login I copied the standard sessions controller to /app/controllers. Code : class Devise::SessionsController < DeviseController prepend_before_filter :require_no_authentication, :only => [ :new, :create ] prepend_before_filter :allow_params_aut

[Rails] Re: Cancan question - create rule issue

2012-11-14 Thread Stan McFarland
Hmmm this kinda makes sense to me, only it didn't work. The proposed? method works correctly, but the can? method in my template returns true for both proposed and non-proposed ProposalRequests. I'm having a hard time getting my head around validating a Proposal against it's parent when t

[Rails] Re: garbage #_=_ in url after authenticated w Devise/Omniauth

2012-11-14 Thread Erwin
[SOLVED] it's a FB addition [SOLVED] from FB ... Change in Session Redirect Behavior This week, we started adding a fragment #*_=_* to the redirect_uri when this field is left blank. Please ensure that your app can handle this behavior. added to my application.js if (window.location.hre

[Rails] 2013 Fukuoka Ruby Award Competition -Entries to be judged by Matz

2012-11-14 Thread Kazuhiro Koga
Dear Ruby Enthusiasts, The Government of Fukuoka, Japan, together with "Matz" Matsumoto, would like to invite you to enter the 2013 Fukuoka Ruby Competition. If you have developed Ruby programs within the past 12 months, this is the competition you've been waiting for. This year, in addition t

[Rails] Re: garbage #_=_ in url after authenticated w Devise/Omniauth

2012-11-14 Thread Erwin
found a clue , but don't know yet how to get rid of it The callback url from FB contains these characters at the end of the code ... #/_=_ seems to be append to the redirect url ( root_url in my case) http://lvh.me:3000/users/auth/facebook/callback?code=AQAPAicWohKyaTYEDqZIfDGgho9fpEeu-r7

[Rails] ActionMailer test helpers

2012-11-14 Thread akalyaev
Hi, I recently found these two helpers (assert_emails, assert_no_emails) inside ActionMailer gem: https://github.com/rails/rails/blob/master/actionmailer/lib/action_mailer/test_helper.rb I wonder why they are not mentioned in the official documentation: - http://guides.rubyonrails.org/testin

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

2012-11-14 Thread Colin Law
On 14 November 2012 12:32, Matt Jones wrote: > > > On Wednesday, 14 November 2012 04:06:21 UTC-5, Colin Law wrote: >> >> On 14 November 2012 07:35, Norbert Melzer wrote: >> > That has nothing to do with rails. Also I dont believe it would be >> > possible >> > without Javascript in general. >> >>

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

2012-11-14 Thread Matt Jones
On Wednesday, 14 November 2012 04:06:21 UTC-5, Colin Law wrote: > > On 14 November 2012 07:35, Norbert Melzer > > wrote: > > That has nothing to do with rails. Also I dont believe it would be > possible > > without Javascript in general. > > It can also be done with html5 I believe, if the u

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

2012-11-14 Thread Werner Laude
Am 14.11.2012 um 11:42 schrieb Erwin : Hi Erwin.. my be you check This. gem 'i18n_routing' Gruss > Thanks Werner, I'm quite there .. I am working as you mentionned .. > but I don't understand why I still have the locale parameter in my root_url : > > in the console : > root_url > "http://lvh

[Rails] garbage #_=_ in url after authenticated w Devise/Omniauth

2012-11-14 Thread Erwin
very strange ... after being authenticated w FB/Google , the user is signe din and redirected to root_url In console : >> Started GET "/users/auth/facebook?display=page" >> (facebook) Request phase initiated. >> Started GET "/users/auth/facebook/callback?code=AQCHRMjDO.. >> (facebook) Call

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

2012-11-14 Thread Dmitry Maksyoma
On Wednesday, November 14, 2012 1:06:45 PM UTC+13, Ruby-Forum.com User wrote: > > 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 givi

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

2012-11-14 Thread Erwin
[SOLVED] writing my previous post, make me thinking about ... def default_url_options(options={}) { :locale => I18n.locale } end which was still in in my application controller . removed it , now it's fine.. thanks again !! Le mercredi 14 novembre 2012 11:42:22 UTC+1, Erwin a écri

[Rails] Re: Ruby on Rails Roadmap

2012-11-14 Thread Mark T.
I respectfully disagree. For someone without development experience, I wouldn't recommend learning yet another language on top of Ruby and Rails. In fact, I would say that a better starting point would be Sinatra (and erb templates). This allows someone familiar with HTML and CSS to ease into learn

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

2012-11-14 Thread Erwin
Thanks Werner, I'm quite there .. I am working as you mentionned .. but I don't understand why I still have the locale parameter in my root_url : in the console : root_url "http://lvh.me:3000/?locale=en"; root_path "/?locale=en" I18n.locale :en I would like to have : root_url "http://lvh.me:300

[Rails] Re: Re: RSpec: controller POST create

2012-11-14 Thread Soichi Ishida
> You can temporarily do `if @plan.save!` to raise an error instead of > just > having it return false and not give you any feedback. the same result including describe "with invalid params" do ... part failures. Doing this is okay > In any case, try to > validate your factory first

[Rails] Re: Cancan question - create rule issue

2012-11-14 Thread Ace Suares
I assume you would need to know if proposal_request.proposals.collect { |p| p.user_id }.include? user.id so maybe you want something in the ProposalRequest like def proposed?(user) proposals.collect { |p| p.user_id }.include? user.id end Now I assume that upon creating a Proposal, it already

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

2012-11-14 Thread nikhil rn
Colin Law wrote in post #1084386: > On 14 November 2012 07:35, Norbert Melzer wrote: >> That has nothing to do with rails. Also I dont believe it would be possible >> without Javascript in general. > > It can also be done with html5 I believe, if the user is using an > html5 compliant browser. > h

[Rails] Re: Cancan question - create rule issue

2012-11-14 Thread Maxim Shytikov
Hi Stan, Try something like this def initialize(user, proposal_request_id) can :create, Proposal unless Proposal.exists?(:proposal_request_id => proposal_request_id, :user_id => user.id) end On Wednesday, November 14, 2012 1:07:51 AM UTC+2, Stan McFarland wrote: > > Hi, RoR newbie here. F

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

2012-11-14 Thread nikhil rn
Norbert Melzer wrote in post #1084375: > 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" : Thank you for your reply.. -- Posted via http://www.ruby-forum.com/. -- You received this message

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

2012-11-14 Thread Tom Geoco
Colin Law wrote in post #1084382: > On 14 November 2012 00:04, Tom Geoco wrote: >> Right now I'm completing Hartl's tutorial, but I'm beginning to pick the >> pace up a bit. > > Whether it the project can be done in 26 days depends on the starting > point. Someone with good software experience an

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

2012-11-14 Thread Colin Law
On 14 November 2012 07:35, Norbert Melzer wrote: > That has nothing to do with rails. Also I dont believe it would be possible > without Javascript in general. It can also be done with html5 I believe, if the user is using an html5 compliant browser. http://davidwalsh.name/html5-context-menu Col

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

2012-11-14 Thread Colin Law
On 14 November 2012 00:04, Tom Geoco wrote: > 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,