Re: [Rails] finding function defenition

2020-03-21 Thread Ariel Juodziukynas
One thing you can do is use a gem like byebug, put a breakpoint above the code you want to find it's location and use this: method(:name_of_method).source_location if you put a breakpoint inside your routes.rb and call: method(:get).source_location it returns something like:

Re: [Rails] On polymorphic associations with has_many through, is it possible to pull in multiple source types with one query?

2020-03-19 Thread Ariel Juodziukynas
I'm not sure if you can have all that with a single AR query, I think you need a custom query (I would use a UNION query an I think AR doesn't support that) El jue., 19 mar. 2020 a las 13:25, Blake LeBlanc () escribió: > When dealing with polymorphic associations, is it possible to have a >

Re: [Rails] Is it worth switching to Postgresql?

2020-03-14 Thread Ariel Juodziukynas
at PostgreSQL is the more favored backend > (except for stuff like Wordpress). We're doing a lot more SQL procedural > stuff these days with our rails apps (e.g. kicking out JSON from a single > query can be literally 1,000x times faster in cases vs. asking Rails to > query a model and forma

Re: [Rails] Is it worth switching to Postgresql?

2020-03-14 Thread Ariel Juodziukynas
Usually ActiveRecord takes care of most of the differences, and postresql has a lot of similarities with mysql. I guess it would be a different call if you ask about learning a completely different db engine like mongo or graphql, but learning postgresql shouldn't take too much time knowing MySQL,

Re: [Rails] Rails session

2020-03-12 Thread Ariel Juodziukynas
I guess you have to use a before block to cache the initial value and then compare that to the final value in the after block El jue., 12 mar. 2020 a las 4:08, Jaleel Ahmed () escribió: > I was wondering if it is possible to know if the rails session has been > modified? > > I am having a around

Re: [Rails] Froala WYSIWYG Editor on Rails 6

2020-02-20 Thread Ariel Juodziukynas
What have ou tried? There's a gem but I think it's only intended to be used with Sprockets and not Webpacker, I would start with the readme https://github.com/froala/wysiwyg-editor using the npm package and importing froala as a module

Re: [Rails] Delayed job :: URGENT

2020-02-19 Thread Ariel Juodziukynas
Each worker runs on a process. When you run the "ps" command on linux you'll see a list of processes running on your system, you'll have as many delayed job processes as you have configured. Each of those processes run a delayed job worker. El mié., 19 feb. 2020 a las 3:21, Shubham Thakur (<

Re: [Rails] Why do basic forms not work in Rails 6 without binding events to each form?

2020-02-18 Thread Ariel Juodziukynas
his, the form is submitted as Javascript (JS). if I add local: > true then the form is submitted as HTML. > > *This is not a bug, it is a complaint. * > > the default behavior (to submit using JS) shouldn't leave my app in a > non-working buggy state (nothing happens unless you bind an ev

Re: [Rails] Why do basic forms not work in Rails 6 without binding events to each form?

2020-02-18 Thread Ariel Juodziukynas
And also (sorry for the multiple responses), you are showing jquery code, rails moved out of jquery a long time ago (I think docs are outdated though), something might be wrong with your setup. El mar., 18 feb. 2020 a las 14:25, Ariel Juodziukynas () escribió: > Can you share some c

Re: [Rails] Why do basic forms not work in Rails 6 without binding events to each form?

2020-02-18 Thread Ariel Juodziukynas
Can you share some code to reproduce the problem? (a github repo with a simple rais app would be greate) El mar., 18 feb. 2020 a las 14:24, Ariel Juodziukynas () escribió: > I have a few rails 6 projects and remote forms works out of the box with > no event binding. Can you rep

Re: [Rails] Why do basic forms not work in Rails 6 without binding events to each form?

2020-02-18 Thread Ariel Juodziukynas
AVE to bind your Ajax events, or else there is no > functionality. (the page does not refresh and gives no user interaction). I > do not think that expecting user interaction is an abnormal expectation in > a modern web app. > > > > On Sunday, February 16, 2020 at 5:39:20 PM U

Re: [Rails] do i need associations to use fields_for

2020-02-17 Thread Ariel Juodziukynas
accepts_nested_attributes_for explicitly checks for associations to exist https://github.com/rails/rails/blob/f33d52c95217212cbacc8d5e44b5a8e3cdc6f5b3/activerecord/lib/active_record/nested_attributes.rb#L340 fields_for does not require accepts_nested_attributes_for to be defined, but it won't

Re: [Rails] Why do basic forms not work in Rails 6 without binding events to each form?

2020-02-16 Thread Ariel Juodziukynas
It doesn't say you that you HAVE to bind all the ajax events. It explicitly says that you "probably" want to do that if you "probably" want to do something other than just submitting the form. El dom., 16 feb. 2020 a las 17:53, Momeas Interactive () escribió: > it says here in the docs that for

Re: [Rails] how do i append an image to a dom element using javascript

2020-01-29 Thread Ariel Juodziukynas
The client part requires javascript, the backend part requires no javascript, I strongly recommend you read this https://guides.rubyonrails.org/action_cable_overview.html Sometimes it looks like you just ask questions without reading about the subject you try to use. The official guide shows you

Re: [Rails] activestorage user.avatar.attached? in javascript

2020-01-28 Thread Ariel Juodziukynas
In your case, you CAN'T call "user.avatar.attached?" inside app/javascript/channels/room_channel.js.erb because it's a request dependant object. El mar., 28 ene. 2020 a las 12:24, Ariel Juodziukynas () escribió: > Although you can use .js.erb extension for any .js file you have to

Re: [Rails] activestorage user.avatar.attached? in javascript

2020-01-28 Thread Ariel Juodziukynas
are used the same way, you can use .erb extension to have ruby code but have to take into account the context to understand what variables you have access to. El mar., 28 ene. 2020 a las 11:17, fugee ohu () escribió: > > > On Monday, January 27, 2020 at 8:28:48 AM UTC-5, Ariel Juodziuky

Re: [Rails] activestorage user.avatar.attached? in javascript

2020-01-27 Thread Ariel Juodziukynas
You can't, you need the .erb extension to execute ruby code. El lun., 27 ene. 2020 a las 0:29, fugee ohu () escribió: > How would I run this same test in javascript without renaming my > room_channel.js to room_channel.js.erb ? > > -- > You received this message because you are subscribed to the

Re: [Rails] //= require stylesheet with webpacker

2020-01-18 Thread Ariel Juodziukynas
"//= require ..." is Sprocket's syntax (most known as rails' assets pipeline), not webpacker's. If you really want to handle CSS assets with webpacker you should start by reading this https://github.com/rails/webpacker/blob/master/docs/css.md El sáb., 18 ene. 2020 a las 4:00, fugee ohu ()

Re: [Rails] ActiveRecord find ignores extra characters after numeric id. ?

2020-01-16 Thread Ariel Juodziukynas
8:36, fugee ohu () escribió: > > > On Wednesday, January 15, 2020 at 8:41:00 PM UTC-5, Ariel Juodziukynas > wrote: >> >> I insist, show your code, show the complete error stacktrace, show the >> log. I can imagine what you are trying to do and from the (little) code

Re: [Rails] ActiveRecord find ignores extra characters after numeric id. ?

2020-01-15 Thread Ariel Juodziukynas
() escribió: > > > On Wednesday, January 15, 2020 at 8:26:45 PM UTC-5, Ariel Juodziukynas > wrote: >> >> find method doesn't care about the to_param method, it just takes the >> parameter you use, I guess it calls "to_i" and uses that integer to query >&g

Re: [Rails] ActiveRecord find ignores extra characters after numeric id. ?

2020-01-15 Thread Ariel Juodziukynas
nes on how to ask, you posts are usually really hard to understand and a lot of information is missing El mié., 15 ene. 2020 a las 18:01, fugee ohu () escribió: > > > On Wednesday, January 15, 2020 at 3:07:00 PM UTC-5, Ariel Juodziukynas > wrote: >> >> From the docs: &

Re: [Rails] ActiveRecord find ignores extra characters after numeric id. ?

2020-01-15 Thread Ariel Juodziukynas
>From the docs: https://apidock.com/rails/v6.0.0/ActiveRecord/FinderMethods/find Person .find ("31-sarah") # returns the object for ID = 31 In your case, if you are using find, it should search for

Re: [Rails] how to pass data to javascript in div.content_tag

2020-01-05 Thread Ariel Juodziukynas
ne. 2020 a las 20:17, fugee ohu () escribió: > > > On Sunday, January 5, 2020 at 8:41:33 AM UTC-5, Ariel Juodziukynas wrote: >> >> No, the first line is ruby and the convention is snakecase so it's ok you >> use underscores, the second line is html and the attributes

Re: [Rails] how to pass data to javascript in div.content_tag

2020-01-05 Thread Ariel Juodziukynas
No, the first line is ruby and the convention is snakecase so it's ok you use underscores, the second line is html and the attributes syntax is hyphen, when you access that data attribute with javascript it will be dataset.conversationWithId as camelcase. You should write using the convention of

Re: [Rails] app/assets/config/manifest.js

2019-12-31 Thread Ariel Juodziukynas
Sprockets 4 added the manifest.js file https://github.com/rails/sprockets#upgrading-to-sprockets-4x. It's not a some rails version thing. El mar., 31 dic. 2019 a las 14:52, fugee ohu () escribió: > Beginning with what rails version is this path expected to exist? > > -- > You received this

Re: [Rails] Re: [rails] devise-in18n messages not localized

2019-12-28 Thread Ariel Juodziukynas
>From the code you can see it uses internationalization https://github.com/plataformatec/devise/blob/098345aace53d4ddf88e04f1eb2680e2676e8c28/app/controllers/devise_controller.rb#L182 You can do something like this on an initializer so override the I18n lookup method to print each key it tries to

Re: [Rails] rails 6 where to put javascript files

2019-12-23 Thread Ariel Juodziukynas
> > > On Sunday, December 22, 2019 at 6:10:58 PM UTC-5, Ariel Juodziukynas wrote: >> >> There's a section specifying where to put js files on the documentation >> https://github.com/rails/webpacker#paths. You can put the files >> anywhere, if you put them inside the

Re: [Rails] webpacker images folder

2019-12-22 Thread Ariel Juodziukynas
a las 20:10, fugee ohu () escribió: > > > On Sunday, December 22, 2019 at 6:08:08 PM UTC-5, Ariel Juodziukynas wrote: >> >> You shouldn't have files inside pack except for the bundles/packs you'll >> link on your html, images go in javacsripts/images, not in >

Re: [Rails] bootstrap nav vs div class: nav

2019-12-22 Thread Ariel Juodziukynas
The "nav" tag provides more meaning, I guess bootstrap just checks the class "navbar" so it doesn't care if you used a div or a nav, but in terms of semantics, a nav tag if better for a navigation bar as the name suggests. El dom., 22 dic. 2019 a las 20:08, fugee ohu () escribió: > Documentation

Re: [Rails] rails 6 where to put javascript files

2019-12-22 Thread Ariel Juodziukynas
There's a section specifying where to put js files on the documentation https://github.com/rails/webpacker#paths. You can put the files anywhere, if you put them inside the packs folder webpacker will create bundles using those files, if you put them elsewhere wenpacker will bundle them inside the

Re: [Rails] webpacker images folder

2019-12-22 Thread Ariel Juodziukynas
You shouldn't have files inside pack except for the bundles/packs you'll link on your html, images go in javacsripts/images, not in javascripts/packs. Just read the guide https://github.com/rails/webpacker/blob/master/docs/assets.md#link-in-your-rails-views El dom., 22 dic. 2019 a las 15:50,

Re: [Rails] Re: access images in stylesheets with webpacker and rails 6

2019-12-22 Thread Ariel Juodziukynas
Webpacker provides an `asset_pack_path` method https://github.com/rails/webpacker#usage I guess you'll need to use a .css.erb file in order for that to work. # something.css.erb .search_button { background: url('<%= asset_pack_path('images/search.png') %>'); } Lately you are asking A LOT of

Re: [Rails] No folder under node_modules after install packages with yarn

2019-12-19 Thread Ariel Juodziukynas
Yarn creates the folder on the directory you run that command. Also it's ok the folder is not inside the packs folder, webpacker creates bundles for any file inside the packs folder, you shouldn't have files other than the packs/bundles you'll link on your html. El jue., 19 dic. 2019 19:47, 'Jake

Re: [Rails] How do I use a favicon in rails 6 ?

2019-12-10 Thread Ariel Juodziukynas
What I mean is that you don't really need webpacker for the favicon, you can just put the favicon.ico file inside app/public and it should work El mar., 10 dic. 2019 09:53, fugee ohu escribió: > > > On Monday, December 9, 2019 at 4:58:45 PM UTC-5, Ariel Juodziukynas wrote: >> &

Re: [Rails] How do I use a favicon in rails 6 ?

2019-12-09 Thread Ariel Juodziukynas
Why don't you just put the favicon.ico file on your /public folder? do you have something special to use javascript for this? El lun., 9 dic. 2019 a las 18:51, fugee ohu () escribió: > I tried creating a favicons folder under app/javascripts/images/favicons > and a favicons.js file in

Re: [Rails] snippet duplicates fields x 8

2019-12-05 Thread Ariel Juodziukynas
I'm sorry, it's "iip.object.item_proerty_id", you have to get the object from the iip form builder El jue., 5 dic. 2019 a las 12:23, fugee ohu () escribió: > > > On Thursday, December 5, 2019 at 7:29:42 AM UTC-5, Ariel Juodziukynas > wrote: >> >> I'm not

Re: [Rails] snippet duplicates fields x 8

2019-12-05 Thread Ariel Juodziukynas
%= iip.text_field :text_value, value: iip.text_value %> <% end %> But I'm not sure that's your intention. Also, a TD inside a DIV is not valid HTML, it will brake your template El jue., 5 dic. 2019 a las 8:04, fugee ohu () escribió: > > > On Wednesday, December 4, 2019 at 3:39:35 PM

Re: [Rails] snippet duplicates fields x 8

2019-12-04 Thread Ariel Juodziukynas
Your form_for uses the @item? if so you are already looping through it's item_item_properties, yo don't need to loop again inside fields_for, you already have iip defined, that's why you have everything multiplied El mié., 4 dic. 2019 a las 11:55, fugee ohu () escribió: > This snippet duplicates

Re: [Rails] new action doesn't render from other model's index page

2019-12-01 Thread Ariel Juodziukynas
I don't think it's a secret, I guess it's right there in the form_with documentation El lun., 2 dic. 2019 01:57, fugee ohu escribió: > > > On Sunday, December 1, 2019 at 11:04:01 PM UTC-5, Walter Lee Davis wrote: >> >> >> >> > On Dec 1, 2019, at 10:17 PM, fugee ohu wrote: >> > >> > A generic

Re: [Rails] new action doesn't render from other model's index page

2019-12-01 Thread Ariel Juodziukynas
Form_with does an ajax request by default, use form_for or add local: true as an option or respond with a js view. El lun., 2 dic. 2019 00:43, fugee ohu escribió: > > > On Sunday, December 1, 2019 at 7:12:18 PM UTC-5, Walter Lee Davis wrote: >> >> Look at a generic Rails controller, fresh out

Re: [Rails] form not loading for get request

2019-12-01 Thread Ariel Juodziukynas
What's your log level value? make sure it's "debug" on your environment https://guides.rubyonrails.org/debugging_rails_applications.html#log-levels El dom., 1 dic. 2019 a las 10:30, fugee ohu () escribió: > > > On Saturday, November 30, 2019 at 9:01:50 PM UTC-5, Ariel J

Re: [Rails] form not loading for get request

2019-11-30 Thread Ariel Juodziukynas
The form looks ok, the parameters on the request too, it's impossible to tell you something else if you have nothing on the logs (rails and the browser's network tab) that could indicate an error El sáb., 30 nov. 2019 a las 22:37, fugee ohu () escribió: > I guess I'd better explain the form I

Re: [Rails] form not loading for get request

2019-11-30 Thread Ariel Juodziukynas
It's normal that rails adds a hidden field with the name `utf8` and a check as the value, when you submit a form using GET the hidden field goes there with the other fields, there's nothing wrong there. You should have some error on the console if something is not working, that `utf8` parameter

Re: [Rails] How do I load schema in rails 6

2019-11-29 Thread Ariel Juodziukynas
: > > > On Tuesday, November 26, 2019 at 9:37:54 AM UTC-5, Ariel Juodziukynas > wrote: >> >> You were trying to reload the schema, db:schema:load requires an empty >> database, I guessed you were OK with removing the data. db:reset it's just >> a shortcut for drop > create

Re: [Rails] How do I load schema in rails 6

2019-11-26 Thread Ariel Juodziukynas
You were trying to reload the schema, db:schema:load requires an empty database, I guessed you were OK with removing the data. db:reset it's just a shortcut for drop > create > schema:load > seed. Why do you want to load the schema if you already have data and you don't want to lose it? that

Re: [Rails] How do I load schema in rails 6

2019-11-26 Thread Ariel Juodziukynas
You can run rails db:reset then El mar., 26 nov. 2019 05:37, Hasan Diwan escribió: > [response inline] > > On Tue, 26 Nov 2019 at 00:00, fugee ohu wrote: > >> Complains that users table already exists >> > > bundle exec rails db:drop db:create db:migrate db:schema:load > > Seems you had a

Re: [Rails] How do I load schema in rails 6

2019-11-25 Thread Ariel Juodziukynas
It is `rails db:schema:load`, run `rails -T` to list all the available tasks. El lun., 25 nov. 2019 a las 23:13, fugee ohu () escribió: > Is there a new command to load the schema in rails 6? > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails:

Re: [Rails] sass-rails

2019-11-23 Thread Ariel Juodziukynas
sass/scss files shouldn't be linked by your website, these files have to be compiled into standard .css files with sprockets, webpacker or any other sass compiler. Usually, if you use sass-rails (or sassc-rails on newer rails version) or webpacker, both gems should take care of compiling the

Re: [Rails] where do i put rails 6 stylesheets

2019-11-23 Thread Ariel Juodziukynas
Rails 6 supports both sprockets (the assets pipeline) and webpacker by default, you can use any of those. You can use app/assets/stylesheets as of previous rails versions that didn't have webpacker or you can follow webacker's readme on CSS

Re: [Rails] app/javascripts/packs ?

2019-11-23 Thread Ariel Juodziukynas
yes, you can delete them El sáb., 23 nov. 2019 a las 13:05, fugee ohu () escribió: > Thanks, Delete all files from public/packs/js for a clean start? > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group

Re: [Rails] app/javascripts/packs ?

2019-11-23 Thread Ariel Juodziukynas
you develop inside /app/javascript/pack, webpacker compiles the js in /public/packs El sáb., 23 nov. 2019 a las 11:50, fugee ohu () escribió: > I read somewhere when adding webpacker to an existing rails app I'd have > this directory app/javascripts/packs but in rails 6 I think it's supposed >

Re: [Rails] build with nested forms

2019-11-02 Thread Ariel Juodziukynas
@item.item_item_properties.item_property_id is wrong, @item.item_item_properties is a collection, use ` iip.object.item_property.name` and `iip.object.item_property_id` instead. imagine @item.item_item_properties is something like an array [item_item_property1, item_item_property2], you can't

Re: [Rails] build method and nested forms

2019-11-02 Thread Ariel Juodziukynas
What do you mean that "pet's attributes can't be found"? found where? how? show the code that doesn't work for you. El sáb., 2 nov. 2019 a las 4:30, fugee ohu () escribió: > if i @users.pets.build then in my form I'll have <%= f.fields_for :pets > do |pet| %> will iterate the same number of

Re: [Rails] need help with carrierwave - multiple vs single file upload

2019-11-01 Thread Ariel Juodziukynas
ere should be multiple FolderAttachments with only one file each. El vie., 1 nov. 2019 a las 14:55, tom () escribió: > usecase: > if i do multiupload, how could i add comments and additional fields to > 'each' file during upload!? > > > > On Fri, Nov 1, 2019 at 1:53 PM Ariel Juod

Re: [Rails] need help with carrierwave - multiple vs single file upload

2019-11-01 Thread Ariel Juodziukynas
I mean: multiple files can be zero or more, it includes the possibility of having only 1 file attached. El vie., 1 nov. 2019 a las 14:53, Ariel Juodziukynas () escribió: > I don't think you can use the same attribute name for single and multiple > attachments at the same time. What you

Re: [Rails] need help with carrierwave - multiple vs single file upload

2019-11-01 Thread Ariel Juodziukynas
gt;>> >>> # Choose what kind of storage to use for this uploader: >>> storage :file >>> >>> # storage :fog >>> >>> # Override the directory where uploaded files will be stored. >>> # This is a sensible default for u

Re: [Rails] need help with carrierwave - multiple vs single file upload

2019-11-01 Thread Ariel Juodziukynas
fog > > # Override the directory where uploaded files will be stored. > # This is a sensible default for uploaders that are meant to be mounted: > def store_dir > "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" > end > > > > any ide

Re: [Rails] need help with carrierwave - multiple vs single file upload

2019-11-01 Thread Ariel Juodziukynas
Also, use "mount_uploader" singular for the single file and "mount_uploaders" plural for the multiple files El vie., 1 nov. 2019 a las 12:44, tom () escribió: > hi, > > i want to have one uploader, but 2 forms: > > Upload Single Attachment > <%= simple_form_for(FolderAttachment.new) do |form| %>

Re: [Rails] need help with carrierwave - multiple vs single file upload

2019-11-01 Thread Ariel Juodziukynas
"always get errors", show the errors then El vie., 1 nov. 2019 a las 12:44, tom () escribió: > hi, > > i want to have one uploader, but 2 forms: > > Upload Single Attachment > <%= simple_form_for(FolderAttachment.new) do |form| %> > <%= form.error_notification %> > > > <%= form.file_field

Re: [Rails] build method

2019-10-31 Thread Ariel Juodziukynas
019 at 11:32:22 PM UTC-4, Ariel Juodziukynas > wrote: >> >> You can do @item.item_item_properties.each do |item_item_property| and >> handle that object inside the loop, I'm not sure why would you expect that >> item_item_properties relationship to return key, value pairs.

Re: [Rails] build method

2019-10-31 Thread Ariel Juodziukynas
path. El vie., 1 nov. 2019 a las 0:27, fugee ohu () escribió: > > > On Thursday, October 31, 2019 at 9:33:22 PM UTC-4, Ariel Juodziukynas > wrote: >> >> @item.item_item_properties returns a collection of objects, you are >> calling a method on something array-like, i

Re: [Rails] build method

2019-10-31 Thread Ariel Juodziukynas
., 31 oct. 2019 a las 22:29, fugee ohu () escribió: > > > On Thursday, October 31, 2019 at 2:15:48 PM UTC-4, Ariel Juodziukynas > wrote: >> >> Use `.size` instead of `.count`. "count" does a database query and since >> you only built the element the COUNT db q

Re: [Rails] build method

2019-10-31 Thread Ariel Juodziukynas
Use `.size` instead of `.count`. "count" does a database query and since you only built the element the COUNT db query will return 0. "size" knows what to do if the association is already initialized so it will return "1" in your case (and if it's not already loaded it will run a COUNT db query).

Re: [Rails] auction site listings table

2019-10-27 Thread Ariel Juodziukynas
/ActionView/Helpers/FormBuilder.html#method-i-fields_for https://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html#method-i-accepts_nested_attributes_for El dom., 27 oct. 2019 a las 12:47, fugee ohu () escribió: > > > On Monday, September 16, 2019 at 4:31:29 PM UTC

Re: [Rails] has_many_through NameError: uninitialized constant

2019-10-21 Thread Ariel Juodziukynas
ItemItemProperty is wrong, belongs_to association should be singular not plural: belongs_to :item and belongs_to :item_property El lun., 21 oct. 2019 08:27, fugee ohu escribió: > i=Item.first > i.item_properties > NameError: uninitialized constant Item::ItemProperties > > class Item <

Re: [Rails] error using direct path url vs ok when navigating by mouse

2019-10-18 Thread Ariel Juodziukynas
You are using `redirect_to request.referrer` and referrer is nil if you enter the url by hand. Use `redirect_back fallback: root_path` instead. El vie., 18 oct. 2019 a las 22:33, fugee ohu () escribió: > > > On Friday, October 18, 2019 at 9:22:09 PM UTC-4, Ariel Juodziuky

Re: [Rails] error using direct path url vs ok when navigating by mouse

2019-10-18 Thread Ariel Juodziukynas
Sorry, `redirect_back fallback_location: root_path`. El vie., 18 oct. 2019 a las 23:08, Ariel Juodziukynas () escribió: > You are using `redirect_to request.referrer` and referrer is nil if you > enter the url by hand. > > Use `redirect_back fallback: root_path` instead. > &g

Re: [Rails] error using direct path url vs ok when navigating by mouse

2019-10-18 Thread Ariel Juodziukynas
Is the link doing a GET request or a POST request? make sure your route matches GET requests too. El vie., 18 oct. 2019 a las 18:07, Colin Law () escribió: > On Fri, 18 Oct 2019 at 19:33, fugee ohu wrote: > >> >> >> On Friday, October 18, 2019 at 5:57:55 AM UTC-4, Colin Law wrote: >>> >>> On

Re: [Rails] Internationalization of stylesheets

2019-10-15 Thread Ariel Juodziukynas
Do the style for each locale differ a lot? Personally, I would use a class or attribute to se the language on the body or the html element and put all languages on the same file and add the language as the selector for the things that should be different. It the difference is little you shouldn't

Re: [Rails] Mysql2::Error: Access denied for user username'@'localhost' (using password: NO)

2019-10-15 Thread Ariel Juodziukynas
>From your other question, you changed mysql to sqlite, somewhere you still have mysql configured. Look for any mysql reference on your code and remove that. El mar., 15 oct. 2019 a las 13:15, fugee ohu () escribió: > > > On Tuesday, October 15, 2019 at 12:11:21 PM UTC-4, Ariel

Re: [Rails] Mysql2::Error: Access denied for user username'@'localhost' (using password: NO)

2019-10-15 Thread Ariel Juodziukynas
I guess it's the same reason for any rails version, bad database configuration. Double check your config/database.yml El mar., 15 oct. 2019 a las 13:04, fugee ohu () escribió: > Is there any reason this would happen in rails 6? > > -- > You received this message because you are subscribed to the

Re: [Rails] jquery function to prevent input from blank field with keypress of

2019-10-15 Thread Ariel Juodziukynas
Do you see any error on the browser's console? first thing I notice just simple looking at it is it's missing all the ; at the end of the lines, maybe you have a syntax error on the browser's dev tools El mar., 15 oct. 2019 a las 11:35, fugee ohu () escribió: > > var submit_messages; > >

Re: [Rails] upgrade to rails 6

2019-10-14 Thread Ariel Juodziukynas
webpacker correctly or you didn't run the webpacker compiler. I suggest you follow the official webpacker guide to understand it https://github.com/rails/webpacker#installation El lun., 14 oct. 2019 a las 20:17, fugee ohu () escribió: > > > On Monday, October 14, 2019 at 6:50:53 PM UTC

Re: [Rails] upgrade to rails 6

2019-10-14 Thread Ariel Juodziukynas
You shouldn't need to do that, you could use yarn to manage JavaScript dependencies with rails 5 too. Also the assets pipeline still works the same way with rails 6, only webpacker is the default now, but you can keep the old behaviour El lun., 14 oct. 2019 19:44, fugee ohu escribió: > to

Re: [Rails] how do i add rows to the associations table in a has_many_through relation

2019-10-05 Thread Ariel Juodziukynas
so you need to use the code on the previous response El dom., 6 oct. 2019 a las 0:33, Ariel Juodziukynas () escribió: > Following the example models from the guide > https://guides.rubyonrails.org/association_basics.html#the-has-many-through-association > you would do

Re: [Rails] how do i add rows to the associations table in a has_many_through relation

2019-10-05 Thread Ariel Juodziukynas
Following the example models from the guide https://guides.rubyonrails.org/association_basics.html#the-has-many-through-association you would do something like: @physician.appointments.create(patient: @patient) El sáb., 5 oct. 2019 a las 19:19, fugee ohu () escribió: > how do i add rows to the

Re: [Rails] Re: get request to new action using form instead of link causes param is missing or the value is empty error

2019-10-04 Thread Ariel Juodziukynas
https://apidock.com/ruby/Hash/fetch fetch tries to get the value from a hash given a key, the second parameter is a fallback in case the key does not exist on the hash (params), in your case, if params[:item] does not exist, it returns {} so the next .fetch won't fail. now the second .fetch tries

Re: [Rails] How do I Include an array from model in views

2019-10-03 Thread Ariel Juodziukynas
SomeClass::ITEM_TYPES El jue., 3 oct. 2019 a las 19:25, fugee ohu () escribió: > ITEM_TYPES = ['General', 'Book', 'Record', 'Magazine', 'Pez dispenser', > 'CD', 'VHS casette'] > Now I wanna use ITEM_TYPES in my view but rails says > undefined method `ITEM_TYPES' for # > > -- > You received

Re: [Rails] Re: Deep Nesting Help

2019-09-26 Thread Ariel Juodziukynas
eld :item_value %> > <%= item.text_area :note %> > > <%= item.fields_for :dd_detail_subitems do |subitem| %> > <%= subitem.label :title %> > <%= subitem.check_box :item_check %> > <%= subitem.te

Re: [Rails] auction site listings table

2019-09-26 Thread Ariel Juodziukynas
fugee ohu () escribió: > > > On Thursday, September 26, 2019 at 4:32:10 PM UTC-4, Ariel Juodziukynas > wrote: >> >> The easiest but too big is a text columns so you can use >> activerecord' serialization of attributes to save anything you want on a >> text field a

Re: [Rails] auction site listings table

2019-09-26 Thread Ariel Juodziukynas
etc... end El jue., 26 sept. 2019 a las 17:17, fugee ohu () escribió: > > > On Monday, September 16, 2019 at 4:31:29 PM UTC-4, Ariel Juodziukynas > wrote: >> >> Personally, I would do this: >> >> auctions table >> (with the basic shared informat

Re: [Rails] Re: Deep Nesting Help

2019-09-26 Thread Ariel Juodziukynas
I'm not sure I understand what's the problem, where exactly do you have doubts? I'd suggest you first refactor that super ugly nested loops and ifs: - remove the unnecesarry if's DdCategory.all.each do |category| # If the Category is active, build it if category.is_active? can't

Re: [Rails] auction site listings table

2019-09-24 Thread Ariel Juodziukynas
Another option (if your database accepts it, like postgres or newer MySQL versions) is to use a column with JSON or JSONB type. You could have a json object with all property/value pairs. I'm not sure about performance, indexing, etc on JSON columns though. I'm not sure what are the categories

Re: [Rails] auction site listings table

2019-09-16 Thread Ariel Juodziukynas
Personally, I would do this: auctions table (with the basic shared information of all auctions and an "auction type")) properties table property_name (like network, carrier, publisher, etc) auction_type (like cellphone, book, etc) auctions_properties auction_id property_id value That way you

Re: [Rails] Carrierwave multiple file uploads

2019-09-14 Thread Ariel Juodziukynas
It adds the "[]" so the parameter is an array (if you don't add that, params[:avatar] will be only one file and not an array). I'm not sure why but the helper does not infer that, you have to be explicit on that. El vie., 13 sept. 2019 a las 12:34, fugee ohu () escribió: > I read this example

Re: [Rails] undefined method '<<' for polymorphic association

2019-09-09 Thread Ariel Juodziukynas
You can do @item.pictures << @picture El mar., 10 sep. 2019 01:02, fugee ohu escribió: > class Item < ApplicationRecord > has_many :pictures, as: :imageable > end > > class Picture < ApplicationRecord > belongs_to :imageable, polymorphic: true, optional: true > end > > NoMethodError in

Re: [Rails] Active Stotage - has_many attached_files ,through: Parent

2019-09-05 Thread Ariel Juodziukynas
https://github.com/rails/rails/blob/master/activestorage/lib/active_storage/attached/model.rb#L114 El jue., 5 sept. 2019 a las 10:21, Ariel Juodziukynas () escribió: > `has_many_attached :files` actually sets to has_many relationships: > `has_many :files_attachments` and `has_many :files

Re: [Rails] Active Stotage - has_many attached_files ,through: Parent

2019-09-05 Thread Ariel Juodziukynas
`has_many_attached :files` actually sets to has_many relationships: `has_many :files_attachments` and `has_many :files_blobs`, you could use those has_many relationships to use on your user's has_many :through relationship. El jue., 5 sept. 2019 a las 2:57, Navid Farjad () escribió: > let's say

Re: [Rails] Rails 6. SyntaxError: missing ) in parenthetical (UJS)

2019-08-26 Thread Ariel Juodziukynas
Can you show the generated response of the request? try using the escape_javascript on the second render too ("j render", the "j" at the beginning). El lun., 26 ago. 2019 a las 9:38, Nikola Okonesh () escribió: > I use pagination ajax (kaminari and pagy gem), click more page not work. > how

Re: [Rails] Why are migrations called migrations?

2019-08-20 Thread Ariel Juodziukynas
The term not just for Rails, schema migration is a database concept https://en.wikipedia.org/wiki/Schema_migration I'm not sure about why the word "migration" is used, but maybe you get somewhere reading database's theory or history. El mar., 20 ago. 2019 a las 13:13, Younes Serraj () escribió:

Re: [Rails] Rails Angular

2019-08-07 Thread Ariel Juodziukynas
You can start with the webpacker helpers https://github.com/rails/webpacker#angular-with-typescript El mié., 7 ago. 2019 a las 4:10, bouazza Mohamed () escribió: > Hello everyone, > > > I am moving to Ruby in rails , i have an interview creating a simple app > With Ruby on rails Angular. > > Do

Re: [Rails] has_many & build & first_or_create

2019-07-11 Thread Ariel Juodziukynas
I don't understand what your are actually trying to do with that. "@p" is an instance of the Project class, "find_or_crate" is a method on active record relations, what do you expect "@p.find_or_create" to do? I guess you can define your own instance method on Project class to do whatever you

Re: [Rails] Unable to connect my ruby ​​on rails APP to a SVN repository

2019-06-28 Thread Ariel Juodziukynas
n copying. > The command works I use the same command with another repository smaller > than this, I was thinking if it's something of the response time or the > timeout, but I can not find anything. > > El jueves, 27 de junio de 2019, 15:39:41 (UTC+2), Ariel Juodziukynas > escribió: >> &

Re: [Rails] Unable to connect my ruby ​​on rails APP to a SVN repository

2019-06-27 Thread Ariel Juodziukynas
You have no blank space between USER and "--password". Also add the option "--verbose" to the comend to see more info of the request. Are you sure the command works? I mean, I don't see how it's related to ruby nor rubyonrails. El jue., 27 jun. 2019 a las 10:12, Harold Alcalde Solarte (<

Re: [Rails] ActionText always wraps content in

2019-06-27 Thread Ariel Juodziukynas
Just define your own partial in your app's app/view folder and it will be used instead of that default partial. El jue., 27 jun. 2019 a las 6:54, Ben Walsh () escribió: > This behaviour is hard-coded in > app/views/action_text/content/_layout.html.erb > > I think it should be possible to

Re: [Rails] Query Bind values with string keys

2019-06-12 Thread Ariel Juodziukynas
can you show an example of your code? you can always do "somestring" => "somevalue" instead of somestring: "somevalue" El mié., 12 jun. 2019 a las 15:24, Sampson Crowley (< sampsonsproje...@gmail.com>) escribió: > Is it possible to use string keys for named query params? I have a very > dynamic

Re: [Rails] @ gem cocoon - how do i

2019-06-10 Thread Ariel Juodziukynas
If you want a blank book just do @user.books.build with no attributes El lun., 10 jun. 2019 a las 16:45, Ariel Juodziukynas () escribió: > Let's say you have a user that has many books, if you want to hace some > book prefilled just do > > @user.books.build(title: something, ye

Re: [Rails] @ gem cocoon - how do i

2019-06-10 Thread Ariel Juodziukynas
Let's say you have a user that has many books, if you want to hace some book prefilled just do @user.books.build(title: something, year: someyear) As long as you don't reload the relationship, the books will be on the user (just not persisted) and `fields_for :books` will iterate over them You

Re: [Rails] Rails 5.2 Custom Credentials — generally accepted way to segregate environments?

2019-06-10 Thread Ariel Juodziukynas
/credentials.yml.enc config/credentials.yml.enc). It you can't add custom command then I don't know haha. El lun., 10 jun. 2019 a las 9:33, t...@datatravels.com (< t...@datatravels.com>) escribió: > > > On Jun 10, 2019, at 12:25 AM, Ariel Juodziukynas > wrote: > > Rails

Re: [Rails] Rails 5.2 Custom Credentials — generally accepted way to segregate environments?

2019-06-09 Thread Ariel Juodziukynas
Rails 6 will have this feature https://github.com/rails/rails/pull/33521 For Rails 5.2, personally, I wouldn't add the file to the source control. I would do this steps: 1- run rails credentials:edit locally 2- add the credentials for production and save 3- upload the file to your hosting at

  1   2   >