[Rails] form fields not in schema

2017-04-21 Thread batuhanwilhelm
You can still add unpersistent attributes to your model and validate them like 
any other attribute on schema. 

You should treat these params like any other param at controller and permit 
them. 

Add this to your model

attr_accessor :some_attribute

So then you can do MyModel.new(some_attribute: 'foo')




-- 
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/0532be8f-74e3-4597-8327-9d56eeb32d85%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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.


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] 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.