Re: [Rails] Form fields not in schema/model

2017-04-20 Thread Colin Law
On 20 April 2017 at 15:12, nynhex  wrote:
> If they’re columns in a table backed by a model, you would simply validate
> them on the model layer.

That is the correct answer to the question asked, but I suspect that
Fugee did not ask the question that he intended to ask.

Colin

>
> On Apr 20, 2017, at 9:06 AM, fugee ohu  wrote:
>
> I'm putting some fields in my form that the controllers gonna use but
> they're columns in the table so I can't validate at the model level? How can
> I validate them?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-talk+unsubscr...@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/fc0a1365-571d-4d33-b518-12f40be8e6b9%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-talk+unsubscr...@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/F0A0D811-16FC-4BFC-A6FC-9107A7D8459D%40gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuzODjYDc1%2BGrE%2BQnEcWJoHKL__v%3DN3U%2BYFMw0vcz2hwQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] no method for nill class

2017-04-20 Thread fugee ohu
In the snippet below,the last line causes the error; :showdate is 
whitelisted, it's components appear just in the params list returned by the 
browser The error's at the plus sign but not sure which of them

@showday = params["showdate(3i)"]
showmonth_string = params["showdate(2i)"]
@showmonth = Date::MONTHNAMES[showmonth_string.to_i]
@showyear = params["showdate(1i)"]
@showdate = @showmonth + " " + @showday + ", " + @showyear

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/b0ab09c9-1484-439b-aa62-4e1b9cd384fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Rails] What may cause request parameters to appear as nested parameters

2017-04-20 Thread Walter Lee Davis
utf8 and authenticity_token are at the "root" level of the params hash, at the 
same level as press_release. They are peers. Press release contains two child 
attributes and their values, because that's the way your form was set up. By 
default, when you use 

<%= form_for @foo do | f | %>

to start off your form, you are going to get a set of parameters like 

{ ... "foo" => { "name" => "Bar", "style" => "Baz" } ... }

in return.

Walter

> On Apr 20, 2017, at 6:00 AM, fugee ohu  wrote:
> 
> Here my params are nested utf8 wraps press_release which in turn wraps venue, 
> venue_country, etc.
> What causes this behavior?
> 
> {"utf8"=>"✓",
>  
> "authenticity_token"=>"qR82bEuyDUS6XD1dxylozc96nGH0kxk/ew+sUe95LT9s+8G9PJqAr06khj0bE9SEPElcinsWxe0Kgzppzq1g0w==",
>  "press_release"=>
>   {"venue"=>"",
>"venue_country"=>"US",
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to rubyonrails-talk+unsubscr...@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/3538a0ba-4671-4fca-99b5-7d56583b39d8%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/98CE44A0-21B1-44E2-BF7E-D1174C245A7A%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] What may cause request parameters to appear as nested parameters

2017-04-20 Thread fugee ohu


Here my params are nested utf8 wraps press_release which in turn wraps venue, 
venue_country, etc.

What causes this behavior?


{"utf8"=>"✓",
 
"authenticity_token"=>"qR82bEuyDUS6XD1dxylozc96nGH0kxk/ew+sUe95LT9s+8G9PJqAr06khj0bE9SEPElcinsWxe0Kgzppzq1g0w==",
 "press_release"=>
  {"venue"=>"",
   "venue_country"=>"US",

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/3538a0ba-4671-4fca-99b5-7d56583b39d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Rails] Re: [QUESTION] How to have different routes ids on different routes for the same resources?

2017-04-20 Thread André Orvalho
Thats great!

I am glad you shared this.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CANrYT%2BU7ORvezXs94RRiXYq7GS%3Ds1Wafbd-rLpdfQdVbdeAyKA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] form fields not in schema

2017-04-20 Thread fugee ohu
I'm putting some fields in my form that the controllers gonna use but 
they're not columns in the table so I can't validate at the model level? 
How can I validate them?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/b9267aef-206d-49de-8b2a-becebafccd80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Form fields not in schema/model

2017-04-20 Thread fugee ohu
I'm putting some fields in my form that the controllers gonna use but 
they're columns in the table so I can't validate at the model level? How 
can I validate them?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/fc0a1365-571d-4d33-b518-12f40be8e6b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: [QUESTION] How to have different routes ids on different routes for the same resources?

2017-04-20 Thread Maurizio De Santis
I have to say that Rails is great. 5.1 introduces a wonderful feature for 
my need: direct 
http://edgeapi.rubyonrails.org/classes/ActionDispatch/Routing/Mapper/CustomUrls.html#method-i-direct

Now in config/routes.rb I can write:

# Content model includes FriendlyId, so content_path(Content.first) calls 
record.to_param using the slug
resources :contents

direct 'edit_admin_content' do |record, options|
  # Here I specify to use the record id, so the resource url will fit 
better with admin section purposes
  options.merge controller: '/admin/contents', action: :edit, id: record.id
end

Same for actions :show, :update and :destroy. Problem solved!

Il giorno giovedì 20 aprile 2017 15:49:55 UTC+2, André Orvalho ha scritto:
>
> I don't think it is an hack what you are doing.
>
> To actually have routes receiving different types of ids you probably 
> needed to change how those helpers are generated by rails.
> That means you might have to monkey patch rails.
>
> The alternative rails is giving you to be able to do this is by doing 
> this: admin_content_path(id: content.id)
>
> So it allows you to pass to override the id passed as argument.
>
> I am sorry but I dont think there is a way around this.
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/2c64950f-5faa-458f-b0f5-2bfdd4017586%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: [QUESTION] How to have different routes ids on different routes for the same resources?

2017-04-20 Thread André Orvalho
I don't think it is an hack what you are doing.

To actually have routes receiving different types of ids you probably 
needed to change how those helpers are generated by rails.
That means you might have to monkey patch rails.

The alternative rails is giving you to be able to do this is by doing this: 
admin_content_path(id: content.id)

So it allows you to pass to override the id passed as argument.

I am sorry but I dont think there is a way around this.



-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/a9b4b875-02c3-4460-a410-f22aede05fd5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Looking for ROR projects to work on

2017-04-20 Thread sadathiru
Hello,

I've a team of ROR developers who are ready to engage in delivering.

We've experienced with different flavor of technologies other than ROR like 
python, java, perl, javascript, git, JSON, REST, SOAP, bash, RDBMS, linux 
commands and few others. 

We've also rich experience of working in different domains in ROR 
development like telecom, inventory, ecommerce, payments/cards, etc.. 

Looking for the right opportunity to work out of remote location.

Thanks in advance!
sadathiru

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/24b542c8-2f10-4778-a244-9f1b64af3294%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Rails] What may cause request parameters to appear as nested parameters

2017-04-20 Thread fugee ohu


On Thursday, April 20, 2017 at 8:05:00 AM UTC-4, Walter Lee Davis wrote:
>
> utf8 and authenticity_token are at the "root" level of the params hash, at 
> the same level as press_release. They are peers. Press release contains two 
> child attributes and their values, because that's the way your form was set 
> up. By default, when you use 
>
> <%= form_for @foo do | f | %> 
>
> to start off your form, you are going to get a set of parameters like 
>
> { ... "foo" => { "name" => "Bar", "style" => "Baz" } ... } 
>
> in return. 
>
> Walter 
>
> > On Apr 20, 2017, at 6:00 AM, fugee ohu  
> wrote: 
> > 
> > Here my params are nested utf8 wraps press_release which in turn wraps 
> venue, venue_country, etc. 
> > What causes this behavior? 
> > 
> > {"utf8"=>"✓", 
> > 
>  
> "authenticity_token"=>"qR82bEuyDUS6XD1dxylozc96nGH0kxk/ew+sUe95LT9s+8G9PJqAr06khj0bE9SEPElcinsWxe0Kgzppzq1g0w==",
>  
>
> >  "press_release"=> 
> >   {"venue"=>"", 
> >"venue_country"=>"US", 
> > 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "Ruby on Rails: Talk" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to rubyonrails-ta...@googlegroups.com . 
> > To post to this group, send email to rubyonra...@googlegroups.com 
> . 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/3538a0ba-4671-4fca-99b5-7d56583b39d8%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>
Thanks 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/65e120b7-90c5-4472-9ef8-391a6e997e71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Rails] Form fields not in schema/model

2017-04-20 Thread nynhex
If they’re columns in a table backed by a model, you would simply validate them 
on the model layer.

> On Apr 20, 2017, at 9:06 AM, fugee ohu  wrote:
> 
> I'm putting some fields in my form that the controllers gonna use but they're 
> columns in the table so I can't validate at the model level? How can I 
> validate them?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to rubyonrails-talk+unsubscr...@googlegroups.com 
> .
> To post to this group, send email to rubyonrails-talk@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/fc0a1365-571d-4d33-b518-12f40be8e6b9%40googlegroups.com
>  
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/F0A0D811-16FC-4BFC-A6FC-9107A7D8459D%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Is there any drawback to eager load Rails app in test environment?

2017-04-20 Thread st0012
The reason I want to do this is because there are some bugs like "circular 
dependencies" can't be found without eager load the entire app.
Since we only eager load at production, we can only notice this kind of 
issues on production. So I think it would be a good idea to eager load 
entire app during testing and we can fix it before it gets deployed.
And I just test this idea on my app and it ran normally on CI and my mac. 
But I'm not sure if there any drawback to do this, like significantly slow 
down the tests?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/76fe127b-c8c3-4a43-8b3c-d6517e808897%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.