Re: [Rails] form.view.erb containing model related and non-model related fields.

2015-06-27 Thread Henry Lawson
Hi, Consider binding your form to an ActiveModel not an ActiveRecord class. In your ActiveModel, you can add in the extra fields that you don't want/have in your ActiveRecord class. Using ActiveModel will also let you follow the same idioms in ActiveRecord, such as validation. Thanks, Henry On 2

[Rails] form.view.erb containing model related and non-model related fields.

2015-06-27 Thread Padmahas Bn
Hello all, I would like to have a form in which some of the fields are linked to model and some fields are not. When I use *form_for* tag it binds to a particular model and I cannot create form fields that aren't correspond to one of the column name of the table (Model). Hence what I think is I

[Rails] Re: how to check the creation of a user? rails4

2015-06-27 Thread Elizabeth McGurty
Just gave this a quick look... What strikes me as odd is this in your User validation: validates :name, presence: true, length: { maximum: 50 },uniqueness: { case_sensitive: false } You want the user name unique yet you do not care about case sensitivity? CAT, cat, Cat, caT And then yo

[Rails] Re: Passing variable to partial failure

2015-06-27 Thread Elizabeth McGurty
Sorry, I see now blocker vs blocked. So same key name observations is wrong... On Saturday, June 27, 2015 at 9:50:29 PM UTC-4, Elizabeth McGurty wrote: > > With regard to button_to, on first (and quick) inspection, I see that you > are missing your first argument, name. > > Your button_to: >

[Rails] Re: Passing variable to partial failure

2015-06-27 Thread Elizabeth McGurty
With regard to button_to, on first (and quick) inspection, I see that you are missing your first argument, name. Your button_to: <%= button_to blockrelationships_path, class: 'btn btn-default btn-xs', params: { blocker_callsign: @callsign,

Re: [Rails] Service PHP in Rails

2015-06-27 Thread Hassan Schroeder
On Sat, Jun 27, 2015 at 12:50 PM, Marco Dias wrote: > I have a small PHP service that is being called in a JavaScript file by AJAX : > I need to use this in my Rails application. I was wondering if I could > put the .php file in a Rails folder, and simply call it. No. > Or if there's a way to d

Re: [Rails] Service PHP in Rails

2015-06-27 Thread Walter Lee Davis
On Jun 27, 2015, at 3:50 PM, Marco Dias wrote: > I have a small PHP service that is being called in a JavaScript file by > AJAX : > >$.ajax({ >type: "GET", >url: "getDate.php", >dataType:"json", >data :{ > fromDate:fromDate, > toDate:toDate >}, >success: fu

[Rails] Passing variable to partial failure

2015-06-27 Thread Bazley
In the view.html.erb: <%= render @posts %> In each _post.html.erb: <%= render partial: 'shared/block', locals: { blockedcallsign: post. callsign } %> In each _block.html.erb: <%= button_to blockrelationships_path, class: 'btn btn-default btn-xs', params: {

[Rails] Passing variable to partial failure

2015-06-27 Thread Bazley
In the view.html.erb: <%= render @posts %> In each _post.html.erb: <%= render partial: 'shared/block', locals: { blockedcallsign: post.callsign } %> In each _block.html.erb: <%= button_to blockrelationships_path, class: 'btn btn-default btn-xs', params: {

[Rails] Service PHP in Rails

2015-06-27 Thread Marco Dias
I have a small PHP service that is being called in a JavaScript file by AJAX : $.ajax({ type: "GET", url: "getDate.php", dataType:"json", data :{ fromDate:fromDate, toDate:toDate }, success: function(data) { .. } }); This service co

Re: [Rails] Re: Re: Unable to access Paperclip Avatar globally

2015-06-27 Thread Colin Law
On 27 June 2015 at 15:25, David Williams wrote: > Colin Law wrote in post #1175739: >> On 26 June 2015 at 16:40, David Williams wrote: "current_user.avatar.url(:thumb)" > >> Also what is the code >> unless: avatar.nil? >> supposed to be doing? I see no code setting up a variable avatar. >>

[Rails] Re: Re: Unable to access Paperclip Avatar globally

2015-06-27 Thread David Williams
Colin Law wrote in post #1175739: > On 26 June 2015 at 16:40, David Williams wrote: >>> "current_user.avatar.url(:thumb)" > Also what is the code > unless: avatar.nil? > supposed to be doing? I see no code setting up a variable avatar. > > Colin I fixed it! - Thanks, anyway. -- Posted via htt

[Rails] Re: Correct location for ActionMailer interceptor

2015-06-27 Thread Cody Skidmore
Thank you Elizabeth. I'm new to Rails so poking around in the Rails source is insightful. Usually the test case is a good guide for how to use a piece of code. The interceptor is declared right inside the test case. The documentation and the test seem to imply that I should declare the interce

[Rails] Re: Correct location for ActionMailer interceptor

2015-06-27 Thread Elizabeth McGurty
To get started: For Rails 3, Railscasts: #206 Action Mailer in Rails 3 At Github, Rails ActionMailer, the interceptor test file is pretty interesting, around line 642 https://github.com/rails/rails/blob/3e36db4406beea32772b1db1e9a16cc1e8aea14c/actionmailer/test/base_test.rb. On Friday, June