[Rails] Too many nested associations?

2020-03-22 Thread fugee ohu
i have user has_many press_releases and also user has_many artists and also 
artists have_many tours and also artists have_many press_releases Now I 
wanna create a tour and then a press_release for the tour The tour is made 
up of tour_dates, just in case you're wondering Complicating things is that 
user has_many press_releases as: :poster so that means all models in the 
chain of has_many_through need to include poster_type and poster_id I'm not 
sure where to use associations I'm tempted to bypass them and just use 
PressRelease.create(... or PressRelease.find_or_create_by(... in a 
controller regardless of the associations Should I use nested forms all the 
way to create press_releases or the direct Model.create method

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/7ffe6c8f-0346-4424-9ecd-5d52fa298185%40googlegroups.com.


[Rails] post request to unassociated model

2020-03-17 Thread fugee ohu
How do I make a post request to an unassociated model from the view of 
another model

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/ef64b815-1b98-47cc-a6e9-47dfb9862c13%40googlegroups.com.


[Rails] help me correct this wrongly syntaxed form_with block

2020-03-11 Thread fugee ohu


The problem I was having is params press_release was missing This is an attempt 
at adding it that draws a sytax error
<%= form_with model: @press_release, url: 
create_user_tour_press_release_path(press_release: { tour_id: @tour.id, 
artist_id: @artist.id, poster_type: 'User' }) do |f| %>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/7d949b7d-fb81-4482-ad56-3b0e39e60e1e%40googlegroups.com.


Re: [Rails] add user_id to new record

2020-03-10 Thread fugee ohu


On Monday, March 2, 2020 at 7:47:37 AM UTC-5, Walter Lee Davis wrote:
>
> In your Controller's #new and #create methods, scope the post to be owned 
> by the current_user (or whatever other scheme you may be using for your 
> logged-in-user management). 
>
> def new 
>   @post = current_user.posts.build 
> end 
>
> def create 
>   @post = current_user.posts.create(post_params) 
>   ... 
> end 
>
> Now your relationship will take care of getting the correct user in there 
> automatically, whether it's in-memory or in persistence. 
>
> NB: If this doesn't appear to work, then you haven't built your 
> relationships correctly, and you need to fix that before proceeding. 
>
> Walter 
>
> > On Mar 2, 2020, at 12:59 AM, fugee ohu > 
> wrote: 
> > 
> > How do i add user_id to a new record without placing it in a form as a 
> hidden field? I tried adding in the controller's create action just before 
> `if @post.save?` but that didn't cause new records created to have a value 
> for user_id Maybe it was because I'm using a nested form and this record is 
> a child record 
> > 
> > -- 
> > 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 rubyonra...@googlegroups.com . 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/3903125c-1f66-4ed3-89dd-b73620d797f2%40googlegroups.com.
>  
>
>
>
Ok thanks And what about passing some params to build?
  @post = current_user.posts.buil(artist_id: @artist.id, tour_id: @tour.id) 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/2fe822d3-bcff-4b54-8f8e-f7893a9733fa%40googlegroups.com.


[Rails] form_with non-associated model on another model's view

2020-03-09 Thread fugee ohu
In my :tour show view I put a form for :press_release and so when the 
form's submitted there's no prepending of press_release: { to the params 
hash The form doesn't have any inputs rather field values are passed in 
parentheses to the route I tried to prepend by adding press_release: { as 
shown below but it causes a syntax error
<%= form_with model: @press_release, 
create_user_tour_press_release_path(press_release: {tour.id: @tour.id, 
artist_id: @artist.id, poster_type: 'User'}) do |f| %>
I originally had it like this:
<%= form_with model: @press_release, 
create_user_tour_press_release_path(tour.id: @tour.id, artist_id: 
@artist.id, poster_type: 'User') do |f| %>
but that had the problem of no prepended press_release to the params 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/32be9300-abbf-47b6-9743-ae0e7edb1fde%40googlegroups.com.


[Rails] form_with from different model

2020-03-03 Thread fugee ohu
In tour_dates show view I've added a form to create a new press_release but 
on submit the request doesn't include a prepended press_release: { it just 
starts with {"authenticity token
This is my form Why doesn't the parameters include a prepended 
press_release object?

<%= form_with model: @press_release, url: 
create_user_tour_press_release_path(artist_id: @artist.id, tour_id: 
@tour.id, poster_id: current_user.id, poster_type: 'User') do |f| %>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/43bde1af-564f-4c37-9871-18a9393a5c1d%40googlegroups.com.


[Rails] add user_id to new record

2020-03-01 Thread fugee ohu
How do i add user_id to a new record without placing it in a form as a 
hidden field? I tried adding in the controller's create action just before 
`if @post.save?` but that didn't cause new records created to have a value 
for user_id Maybe it was because I'm using a nested form and this record is 
a child record

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/3903125c-1f66-4ed3-89dd-b73620d797f2%40googlegroups.com.


[Rails] Re: Froala WYSIWYG Editor on Rails 6

2020-02-27 Thread fugee ohu


On Thursday, February 20, 2020 at 7:35:54 AM UTC-5, SM Ehsan wrote:
>
> Hello
> I a trying to add froala WYSIWYG editor to my rails 6 project.
> but i am unable to add this.
> can any one please tell me how can i add froala WYSIWYG editor to my 
> project?
>
> Thank you
>

rails 6 includes Trix wysiwyg editor, its easy to setup 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/b4eaafa5-0548-419e-80fb-3fed6fded93f%40googlegroups.com.


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

2020-02-16 Thread fugee ohu


On Monday, February 17, 2020 at 12:38:03 AM UTC-5, Walter Lee Davis wrote:
>
> You may use fields_for for any object that you have declared 
> "accepts_nested_attributes_for" in your form's parent model. It obviously 
> makes the most sense to do this with a related object. 
>
> Walter 
>
> > On Feb 16, 2020, at 10:41 PM, fugee ohu > 
> wrote: 
> > 
> > Can I use fields_for for any models or do they have to be associated? 
> > 
> > -- 
> > 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 rubyonra...@googlegroups.com . 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/09881329-3137-4c90-94a1-6495bccc90bd%40googlegroups.com.
>  
>
>

In my app users have many artists, artists have many tourdates, artists 
have many venues, users have many venues through artists, tour_dates when 
added have to provide a venue so they can select from clubs or festivals 
that are included in the app, and they can also create a user defined 
venue, or select from previous user defined venues I had this working 
before I started concerning myself with associations by prepending all the 
venue fields with venue so state and city become venue_state and venue_city 
and I add an attribute_accessor to the tour_dates model for each venue 
field I feel like that still the way to do it, as long as the user defined 
venues belong to the artist and user so if the user ever deletes the artist 
the venue will be deleted also

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/f2ba1d66-8420-41e9-b228-2456080f0ffb%40googlegroups.com.


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

2020-02-16 Thread fugee ohu


On Monday, February 17, 2020 at 12:38:03 AM UTC-5, Walter Lee Davis wrote:
>
> You may use fields_for for any object that you have declared 
> "accepts_nested_attributes_for" in your form's parent model. It obviously 
> makes the most sense to do this with a related object. 
>
> Walter 
>
> > On Feb 16, 2020, at 10:41 PM, fugee ohu > 
> wrote:
> > 
> > Can I use fields_for for any models or do they have to be associated? 
> > 
> > -- 
> > 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 rubyonra...@googlegroups.com . 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/09881329-3137-4c90-94a1-6495bccc90bd%40googlegroups.com.
>  
>
>
>
If you use accepts_nested_attributes_for in a model without an association 
rails will raise an error In my models users have many artists, artists 
have many tour_dates and tour_dates have many user_venues I need to add 
fields for user_venues to the tour_dates form Pretty confused what to do

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/f0c2006c-4cdc-4994-8e15-53fa34cb7a39%40googlegroups.com.


[Rails] do i need associations to use fields_for

2020-02-16 Thread fugee ohu
Can I use fields_for for any models or do they have to be associated?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/09881329-3137-4c90-94a1-6495bccc90bd%40googlegroups.com.


[Rails] what are the association requirements for fields_for

2020-02-16 Thread fugee ohu
I want to create rows in one model from a form for another where 
associations aren't as simple as the fields_for model belonging to the main 
model of the form
In my case, I wanna add rows to :user_venue where the main form is for 
:tour_dates
tour_dates belong to tours, which belong to artists, which belong to users
user_venues belong to artists also but only where the artist user_id is the 
current_user

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/bb6949ce-43a1-4358-9f5e-76ac5490e087%40googlegroups.com.


Re: [Rails] redirect shown in log, but browser not redirecting

2020-02-14 Thread fugee ohu


On Friday, February 14, 2020 at 12:04:55 PM UTC-5, Walter Lee Davis wrote:
>
> Is your form set to the default of an Ajax submission, or did you add the 
> configuration flag to the form_with method call that makes it actually 
> redirect? If this was a redirect, the header would be 301, not 200. 
>
> Walter
>
> On Feb 14, 2020, at 9:59 AM, fugee ohu > 
> wrote:
>
> 
> This is a redirect from my log, but page doesn't change I'm still on the 
> same page containing the form I submitted
>
> 127.0.0.1 - - [14/Feb/2020:11:55:46 EST] "GET /artists/72/press_releases 
> HTTP/1.1" 200 2542
> http://localhost:3000/artists/72/tours/1 -> /artists/72/press_releases
>
> -- 
> 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 rubyonra...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/be527a35-e686-4968-8849-ca05ecfc2491%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/rubyonrails-talk/be527a35-e686-4968-8849-ca05ecfc2491%40googlegroups.com?utm_medium=email_source=footer>
> .
>
>
Well I hope you're still with me on this cause I solved it and I don't have 
anyone else to tell For some reason I had commented out `gem turbolinks`  
in my Gemfile I'm upgrading all my apps to rails 6 and really to webpacker 
I remember reading somewhere the new way of doing things is to not use 
turbolinks I don't remember where 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/2aab187e-810f-4122-8318-fd6ced48d405%40googlegroups.com.


Re: [Rails] redirect shown in log, but browser not redirecting

2020-02-14 Thread fugee ohu


On Friday, February 14, 2020 at 12:04:55 PM UTC-5, Walter Lee Davis wrote:
>
> Is your form set to the default of an Ajax submission, or did you add the 
> configuration flag to the form_with method call that makes it actually 
> redirect? If this was a redirect, the header would be 301, not 200. 
>
> Walter
>
> On Feb 14, 2020, at 9:59 AM, fugee ohu > 
> wrote:
>
> 
> This is a redirect from my log, but page doesn't change I'm still on the 
> same page containing the form I submitted
>
> 127.0.0.1 - - [14/Feb/2020:11:55:46 EST] "GET /artists/72/press_releases 
> HTTP/1.1" 200 2542
> http://localhost:3000/artists/72/tours/1 -> /artists/72/press_releases
>
> -- 
> 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 rubyonra...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/be527a35-e686-4968-8849-ca05ecfc2491%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/rubyonrails-talk/be527a35-e686-4968-8849-ca05ecfc2491%40googlegroups.com?utm_medium=email_source=footer>
> .
>
>
 respond_to do |format|
  if @press_release.save
format.html { redirect_to 
user_artist_press_releases_path(artist_id: params[:artist_id]), notice: 
'Press release was successfully created.' }
format.json { render :show, status: :created, location: 
@press_release }
  else
format.html { render 'user_press_releases/_form'}
format.json { render json: @press_release.errors, status: 
:unprocessable_entity }
  end
end

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/87ab8278-a0b0-467c-8cce-3af53460643e%40googlegroups.com.


Re: [Rails] redirect shown in log, but browser not redirecting

2020-02-14 Thread fugee ohu


On Friday, February 14, 2020 at 12:04:55 PM UTC-5, Walter Lee Davis wrote:
>
> Is your form set to the default of an Ajax submission, or did you add the 
> configuration flag to the form_with method call that makes it actually 
> redirect? If this was a redirect, the header would be 301, not 200. 
>
> Walter
>
> On Feb 14, 2020, at 9:59 AM, fugee ohu > 
> wrote:
>
> 
> This is a redirect from my log, but page doesn't change I'm still on the 
> same page containing the form I submitted
>
> 127.0.0.1 - - [14/Feb/2020:11:55:46 EST] "GET /artists/72/press_releases 
> HTTP/1.1" 200 2542
> http://localhost:3000/artists/72/tours/1 -> /artists/72/press_releases
>
> -- 
> 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 rubyonra...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/be527a35-e686-4968-8849-ca05ecfc2491%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/rubyonrails-talk/be527a35-e686-4968-8849-ca05ecfc2491%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> , 
I never heard of a configuration flag in a form to cause a redirect, I'm 
redirecting from a post action in a controller

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/58dc663c-c96b-467a-b519-a284edc53456%40googlegroups.com.


Re: [Rails] redirect shown in log, but browser not redirecting

2020-02-14 Thread fugee ohu


On Friday, February 14, 2020 at 12:04:55 PM UTC-5, Walter Lee Davis wrote:
>
> Is your form set to the default of an Ajax submission, or did you add the 
> configuration flag to the form_with method call that makes it actually 
> redirect? If this was a redirect, the header would be 301, not 200. 
>
> Walter
>
> On Feb 14, 2020, at 9:59 AM, fugee ohu > 
> wrote:
>
> 
> This is a redirect from my log, but page doesn't change I'm still on the 
> same page containing the form I submitted
>
> 127.0.0.1 - - [14/Feb/2020:11:55:46 EST] "GET /artists/72/press_releases 
> HTTP/1.1" 200 2542
> http://localhost:3000/artists/72/tours/1 -> /artists/72/press_releases
>
> -- 
> 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 rubyonra...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/be527a35-e686-4968-8849-ca05ecfc2491%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/rubyonrails-talk/be527a35-e686-4968-8849-ca05ecfc2491%40googlegroups.com?utm_medium=email_source=footer>
> .
>
>
<%= form_with model: @press_release, url: 
create_user_tour_press_release_path(artist_id: @artist.id, tour_id: 
@tour.id), remote: false do |f| %>
<%= f.hidden_field :artist_id, value: @artist.id %>
<%= f.hidden_field :tour_id, value: @tour.id %>

<%= f.submit 'Create press release' %>

<% end %>
 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/b9b8c365-b79c-470b-aff1-a3c1d3b9fe09%40googlegroups.com.


[Rails] redirect shown in log, but browser not redirecting

2020-02-14 Thread fugee ohu
This is a redirect from my log, but page doesn't change I'm still on the 
same page containing the form I submitted

127.0.0.1 - - [14/Feb/2020:11:55:46 EST] "GET /artists/72/press_releases 
HTTP/1.1" 200 2542
http://localhost:3000/artists/72/tours/1 -> /artists/72/press_releases

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/be527a35-e686-4968-8849-ca05ecfc2491%40googlegroups.com.


[Rails] Re: how do i use jquery-datetimepicker with webpacker

2020-02-11 Thread fugee ohu


On Tuesday, February 11, 2020 at 12:03:35 PM UTC-5, jake wrote:
>
> Probably something like this in application.js:
>
> import 'jquery-datetimepicker';
>
> I would pick a lib with better docs tho: 
> https://flatpickr.js.org/getting-started/
>
> On Tuesday, February 11, 2020 at 2:56:16 AM UTC-6, fugee ohu wrote:
>>
>> I installed it with yarn but I don't know how to get it working
>>
>
How do I apply different options to different fields? 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/712cbb63-be19-4fc6-9d97-7897bc71a18c%40googlegroups.com.


[Rails] how do i use jquery-datetimepicker with webpacker

2020-02-11 Thread fugee ohu
I installed it with yarn but I don't know how to get it working

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/198899a8-4765-440c-a3f9-6b8310432170%40googlegroups.com.


[Rails] bootstrap nav can't right align ul

2020-02-07 Thread fugee ohu
I'm trying to right align a  in my navbar but it doesn't right align, 
it's left aligned


 <% blog_logo=@blog.pictures.where('designation=?', 'blog_logo').first 
%>

<%= 
@blog.title %>

  

  

  


<% if user_signed_in? %>
  
  
  <%= current_user.name %>
  

  <%= link_to (t 'main_site'), 
"http://www.#{request.domain}; %>
  <%= link_to (t 'sign_out'), 
destroy_user_session_path, method: :delete %>

   
  
  
<% else %>
  
<%= link_to (t 'sign_in'), new_user_session_path %>
  
<% end %>
<% if admin_signed_in? %>
 <%= link_to current_admin.name, 
administration_path,  class: "nav-item" %>
<% end %>

  


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/1c51c5c3-e928-479e-ae86-37ad10ae14aa%40googlegroups.com.


[Rails] searchkick show associations in view

2020-02-05 Thread fugee ohu
How do I show associations in a view with searchkick? I get error 
association not found even though user has_many_addresses
My user model has 

scope :search_import, -> { includes(:addresses) }

search.html.erb:

<%= (t 'search_results_for') %> <%= @terms %>

 <% @users.each do |u| %>
   
  <%= link_to "#{u.first_name} #{u.middle_name} #{u.last_name}", 
page_path(name: u.name) %>
<% ua=u.addresses.where("current=?, limit: 1", true)  %>
<% if ua.country=="US" %>
<%= ua.city %>, <%= ua.state %> <%= 
ISO3166::Country.find_country_by_alpha2(ua.country) %>
<% else %>
<%= ua.city %>, <%= 
ISO3166::Country.find_country_by_alpha2(ua.country) %>
<% end %>
  
 <% end %>



-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/34df3737-250d-4dfa-b9ed-3ffb06c7354b%40googlegroups.com.


[Rails] Re: help me perform my first searchkick search

2020-02-04 Thread fugee ohu


On Tuesday, February 4, 2020 at 8:08:17 PM UTC-5, fugee ohu wrote:
>
> So far, I don't get any results returned
>
> user.rb:
>
> searchkick  word_middle: ['full_name', 'description', 'interests'] 
>
>  def full_name
>   [first_name, last_name].join(' ') 
>  end
>  
>  def search_data
>{
>full_name: full_name,
>description: description,
>interests: interests
>}
>  end 
>
> world_controller.rb
> def search
>   @terms=params[:terms]
>   search = params[:terms].present? ? params[:terms] : nil
> @users = if search
>User.search(search)
> end
> end
>
>
I solved this by adding User.reindex to my controller action 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/c84fa29b-fe84-4424-8f52-1df1c35a8b74%40googlegroups.com.


[Rails] help me perform my first searchkick search

2020-02-04 Thread fugee ohu
So far, I don't get any results returned

user.rb:

searchkick  word_middle: ['full_name', 'description', 'interests'] 

 def full_name
  [first_name, last_name].join(' ') 
 end
 
 def search_data
   {
   full_name: full_name,
   description: description,
   interests: interests
   }
 end 

world_controller.rb
def search
  @terms=params[:terms]
  search = params[:terms].present? ? params[:terms] : nil
@users = if search
   User.search(search)
end
end

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/ec49e885-5b99-41f0-ac42-fa820743064e%40googlegroups.com.


[Rails] undefined method `addresses' for #

2020-02-02 Thread fugee ohu
world_controller.rb

  @users = User.search(params[:terms]).where("confirmed_at is not null")

search.html.erb

<%= (t 'search_results_for') %> <%= @terms %>

 <% @users.each do |u| %>
   
  <%= link_to "#{u.first_name} #{u.middle_name} #{u.last_name}", 
page_path(name: u.name) %>
<% ua=u.addresses.where("current=?", true) %>
<% if ua.country=="US" %>
<%= ua.city %>, <%= ua.state %> <%= 
ISO3166::Country.find_country_by_alpha2(ua.country) %>
<% else %>
<%= ua.city %>, <%= 
ISO3166::Country.find_country_by_alpha2(ua.country) %>
<% end %>
  
 <% end %>


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/483fbefa-8bdc-41a4-b1d4-6573528a1e37%40googlegroups.com.


[Rails] search form in layout

2020-02-02 Thread fugee ohu
I put a search form in my layout where the search field is named "terms" 
but then I get an unpermitted parameters for 'term' Do I need to declare 
term as an attr_accessor and use the :user in strong params in my world 
controller because I'm searching the User model

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/8704a48b-9177-4a24-9b3b-c0073fa22168%40googlegroups.com.


Re: [Rails] How do I prevent rails from redirecting to request referrer after create

2020-01-29 Thread fugee ohu


On Monday, January 27, 2020 at 10:52:28 PM UTC-5, Walter Lee Davis wrote:
>
> You can define (in your controller) what the create action is after a 
> successful save, and if you only want to do that for one format, and not 
> the others, you can use the usual method for doing that in a controller, 
> with: 
>
> if @foo.create(foo_params) 
>   respond_to do |format| 
> if format.js 
>   render status: :ok 
> else 
>   redirect_to @foo 
> end 
>   end 
> else 
>   render :new 
> end 
>
> Using render status: :ok on success will not let anything else happen, no 
> redirect, nothing changes on screen. 
>
> Walter 
>
>
> > On Jan 27, 2020, at 8:48 PM, fugee ohu > 
> wrote: 
> > 
> > I'm broadcasting to a javascript channel in my create action instead of 
> redirecting but rails redirects to request referrer 
> > 
> > -- 
> > 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 rubyonra...@googlegroups.com . 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/1b7ecb28-06c2-4638-9a37-221bf911da28%40googlegroups.com.
>  
>
>
>
Cool Thanks I had solved this by removing respond_to and rails 
automatically returned 204 No content because there was no view Maybe 
that's not a good hack though with no respond_to 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/408898fb-3122-4cc4-9df6-72a6e6333086%40googlegroups.com.


[Rails] how do i reference active storage attachments to get the url

2020-01-29 Thread fugee ohu
Message 
has_one_attached :attachment

but if i put console.log(url_for(message.attachment)) webpack-dev-server 
returts compiled with warnings and nothing happens when i submit the form 
How do I reference the url and other attributes of the attachement?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/b8bc2035-343d-4a7d-bc0b-ed92384a2097%40googlegroups.com.


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

2020-01-29 Thread fugee ohu


On Wednesday, January 29, 2020 at 11:28:49 AM UTC-5, Ariel Juodziukynas 
wrote:
>
> 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 what file goes where.
>
> El mié., 29 ene. 2020 a las 13:08, fugee ohu ( >) escribió:
>
>>
>>
>> On Wednesday, January 29, 2020 at 8:18:28 AM UTC-5, Walter Lee Davis 
>> wrote:
>>>
>>>
>>> https://lmgtfy.com/?q=how+do+i+append+an+image+to+a+dom+element+using+javascript
>>>  
>>>
>>> > On Jan 29, 2020, at 12:18 AM, fugee ohu  wrote: 
>>> > 
>>> > how do i append an image to a dom element using javascript 
>>> > 
>>> > -- 
>>> > 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 rubyonra...@googlegroups.com. 
>>> > To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/rubyonrails-talk/a3f1366c-1bbb-4363-8a06-65b538719a32%40googlegroups.com.
>>>  
>>>
>>>
>>
>> Thanks I'm trying to write an action cable chat app Eventually I want it 
>> to include video but for now I've got text working but I don't have images 
>> working yet Do all action cable chat solutions rely on javascript (?) 
>> because I notice there's an app/channels folder and an 
>> app/javascript/channels folder Does that mean I don't need to be using 
>> javascript?
>>
>> -- 
>> 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 rubyonra...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/rubyonrails-talk/62555a89-a69e-485b-8117-f17394a5b676%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/rubyonrails-talk/62555a89-a69e-485b-8117-f17394a5b676%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
Yes Thanks I'll read that I've been reading active storage overview trying 
to work out a better understanding of the attachment/s object how to render 
attachments because I'm having trouble with it

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/9c2320fa-db27-4659-9634-c3f4724fd96d%40googlegroups.com.


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

2020-01-29 Thread fugee ohu


On Wednesday, January 29, 2020 at 8:18:28 AM UTC-5, Walter Lee Davis wrote:
>
>
> https://lmgtfy.com/?q=how+do+i+append+an+image+to+a+dom+element+using+javascript
>  
>
> > On Jan 29, 2020, at 12:18 AM, fugee ohu > 
> wrote: 
> > 
> > how do i append an image to a dom element using javascript 
> > 
> > -- 
> > 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 rubyonra...@googlegroups.com . 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/a3f1366c-1bbb-4363-8a06-65b538719a32%40googlegroups.com.
>  
>
>

Thanks I'm trying to write an action cable chat app Eventually I want it to 
include video but for now I've got text working but I don't have images 
working yet Do all action cable chat solutions rely on javascript (?) 
because I notice there's an app/channels folder and an 
app/javascript/channels folder Does that mean I don't need to be using 
javascript?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/62555a89-a69e-485b-8117-f17394a5b676%40googlegroups.com.


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

2020-01-28 Thread fugee ohu
how do i append an image to a dom element using javascript

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/a3f1366c-1bbb-4363-8a06-65b538719a32%40googlegroups.com.


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

2020-01-28 Thread fugee ohu


On Monday, January 27, 2020 at 8:28:48 AM UTC-5, Ariel Juodziukynas wrote:
>
> 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 Google Groups 
>> "Ruby on Rails: Talk" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to rubyonra...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/rubyonrails-talk/bdf21e73-81a0-4485-957e-82afa0e2d6a9%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/rubyonrails-talk/bdf21e73-81a0-4485-957e-82afa0e2d6a9%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
I can change any .js file to .js.erb ? In this case it's 
app/javascript/channels/room_channel.js Passing data between javascript and 
rails is an important topic so I wanna learn as best I can without 
"cheating" but I'm attracted to the js.erb method too, I wanna mix it up 
something use js.erb sometimes use just .js so I don't end up ignorant

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/3866a144-220f-4e6a-ad06-090226af6ef9%40googlegroups.com.


Re: [Rails] How do I prevent rails from redirecting to request referrer after create

2020-01-27 Thread fugee ohu


On Monday, January 27, 2020 at 10:52:28 PM UTC-5, Walter Lee Davis wrote:
>
> You can define (in your controller) what the create action is after a 
> successful save, and if you only want to do that for one format, and not 
> the others, you can use the usual method for doing that in a controller, 
> with: 
>
> if @foo.create(foo_params) 
>   respond_to do |format| 
> if format.js 
>   render status: :ok 
> else 
>   redirect_to @foo 
> end 
>   end 
> else 
>   render :new 
> end 
>
> Using render status: :ok on success will not let anything else happen, no 
> redirect, nothing changes on screen. 
>
> Walter 
>
>
> > On Jan 27, 2020, at 8:48 PM, fugee ohu > 
> wrote: 
> > 
> > I'm broadcasting to a javascript channel in my create action instead of 
> redirecting but rails redirects to request referrer 
> > 
> > -- 
> > 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 rubyonra...@googlegroups.com . 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/1b7ecb28-06c2-4638-9a37-221bf911da28%40googlegroups.com.
>  
>
>
> Thanks I solved that problem by removing the respond_to do |format| block 
and putting  respond_to :js, only: [:create] after my callbacks

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/f920ca6e-b9a1-4387-84e4-0b07526ae26c%40googlegroups.com.


[Rails] How do I prevent rails from redirecting to request referrer after create

2020-01-27 Thread fugee ohu
I'm broadcasting to a javascript channel in my create action instead of 
redirecting but rails redirects to request referrer

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/1b7ecb28-06c2-4638-9a37-221bf911da28%40googlegroups.com.


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

2020-01-26 Thread fugee ohu
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 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/bdf21e73-81a0-4485-957e-82afa0e2d6a9%40googlegroups.com.


[Rails] Trix rich_text_area form field doesn't clear on submit when containing an image

2020-01-23 Thread fugee ohu
If this form contains an image the rich_text_area field doesn't clear 
because I'm calling 
ActionCable.server.broadcast 'room_channel', content: @message.content, 
msg_time: Time.now, recipients: @message.recipients, sender: 
@message.sender, sender_name: User.find(@message.sender).name


<%= form_with model: @message, multipart: true, remote: true do |f| %>
<%= f.rich_text_area :content, class: 'form-control' %>
<%= f.hidden_field :recipients, value: @conversation_with.id %>
<%= f.hidden_field :sender, value: current_user.id %>
<%= f.submit 'Send' %>
<% end %>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/03f98b9b-e97c-4ef0-b0b5-2a46afefabff%40googlegroups.com.


[Rails] ActionCable.server.broadcast sending truncated version of rich-text-field to channel

2020-01-22 Thread fugee ohu


>From the log:

RoomChannel transmitting {"content"=>"https://groups.google.com/d/msgid/rubyonrails-talk/63d4d627-abd6-4fca-b010-bc88d0bd73cf%40googlegroups.com.


Re: [Rails] how do i send pictures in channels?

2020-01-21 Thread fugee ohu


On Sunday, January 19, 2020 at 4:56:19 PM UTC-5, Walter Lee Davis wrote:
>
>
>
> > On Jan 19, 2020, at 4:10 PM, fugee ohu > 
> wrote: 
> > 
> > Got my chat app working in rails 6 with channels but now how do I let 
> users send  pictures in channels? I've seen chat apps where after you 
> upload the picture it displays with a circled button that says send and you 
> can also delete it instead How do I do that? 
> > 
>
> With JavaScript. One of the neatest implementations I've seen of this is 
> in Trix (ActionText), which is open-source, so you could see how they do it 
> there. Also GitLab has a nice one, and the source is available for that 
> (unlike GitHub, who also have one). You're basically intercepting the drop 
> and paste events, checking to see whether the payload was an image, and 
> then doing some out-of-band trickery to make a file attachment using a 
> separate model and controller. Trix uses the new ActiveStorage goodies for 
> its implementation. Not sure what the others use. 
>
> Walter 
>
>
Yes thanks I went with trix on this The problem I'm having now is 
ActionCable.server.broadcast unexpectedly sends a truncated version of the 
value of the rich text field over to my channel Maybe something in 
ActionCable config?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/9a98d700-342a-416a-9ccc-ed8574365b30%40googlegroups.com.


[Rails] trix actiontext rich content append to div in view from js file (actioncable channel) not displaying rich content, field not clearing after submit

2020-01-20 Thread fugee ohu
My app was working before I tried adding images in the richtext field Now 
the form field doesn't clear on submit and everything appends to the 
element I'm appending to from my javascript channel file (room.js) wrapped 
in  So the problem is it doesn't display until 
the page is refreshed then they're displayed from the database and the form 
field doesn't clear

$('#message_holder').append('' + data.sender_name + '' + data.msg_time + '' 
+ data.content.body  + '');

Here it is in page source appended to the bottom of 

   fugeeMon, 20 Jan 2020 20:13:46 +
 heyhttp://localhost:3000/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBFUT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--bffdde6476172b543d8e5dd879a742b559406b74/Katana2.jpg;
 filename="Katana2.jpg" filesize="26982" width="410" height="512" 
previewable="true" presentation="gallery">http://localhost:3000/rails/active_storage/representations/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBFUT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--bffdde6476172b543d8e5dd879a742b559406b74/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9VY21WemFYcGxYM1J2WDJ4cGJXbDBXd2RwQWdBRWFRSUFBdz09IiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--69a726fe314cc814b26ade236a1f8e8b78481edd/Katana2.jpg;>
Katana2.jpg  26.3 KB  


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/224b03d3-2851-41d4-9b42-0880875691bd%40googlegroups.com.


[Rails] how do i append a json object to a css selector in the dom

2020-01-20 Thread fugee ohu
I need to append this json object including images to a css selector Anyone 
can tell me how
{
  "id": 43,
  "name": "content",
  "body": "http://localhost:3000/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBEQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--f5de0e90b1f4146080f3d8482b1e535ff3204d79/Katana.jpg\;
 
filename=\"Katana.jpg\" filesize=\"39537\" width=\"471\" height=\"512\" 
presentation=\"gallery\">",
  "record_type": "Message",
  "record_id": 283,
  "created_at": "2020-01-20T13:12:09.813Z",
  "updated_at": "2020-01-20T13:12:09.846Z"
}

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/4488ccba-1b8e-4522-b62a-75d12f0dfe9c%40googlegroups.com.


Re: [Rails] how do i send pictures in channels?

2020-01-20 Thread fugee ohu


On Sunday, January 19, 2020 at 4:56:19 PM UTC-5, Walter Lee Davis wrote:
>
>
>
> > On Jan 19, 2020, at 4:10 PM, fugee ohu > 
> wrote: 
> > 
> > Got my chat app working in rails 6 with channels but now how do I let 
> users send  pictures in channels? I've seen chat apps where after you 
> upload the picture it displays with a circled button that says send and you 
> can also delete it instead How do I do that? 
> > 
>
> With JavaScript. One of the neatest implementations I've seen of this is 
> in Trix (ActionText), which is open-source, so you could see how they do it 
> there. Also GitLab has a nice one, and the source is available for that 
> (unlike GitHub, who also have one). You're basically intercepting the drop 
> and paste events, checking to see whether the payload was an image, and 
> then doing some out-of-band trickery to make a file attachment using a 
> separate model and controller. Trix uses the new ActiveStorage goodies for 
> its implementation. Not sure what the others use. 
>
> Walter 
>
>
When I put images in Trix it returns an object How do I render the object 
in html by appending to a css selector ? In the code below I'm using 
data.content.body but it returns the string show below 

   $('#message_holder').append('' + data.sender_name + 
'' + data.msg_time + '' + data.content.body + '');

{
  "id": 39,
  "name": "content",
  "body": "http://localhost:3000/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBEQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--f5de0e90b1f4146080f3d8482b1e535ff3204d79/Katana.jpg\;
 
filename=\"Katana.jpg\" filesize=\"39537\" width=\"471\" height=\"512\" 
presentation=\"gallery\">",
  "record_type": "Message",
  "record_id": 279,
  "created_at": "2020-01-20T07:16:41.274Z",
  "updated_at": "2020-01-20T07:16:41.312Z"
}

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/f6282c17-b4d2-4f87-90e3-c7e55dea2f49%40googlegroups.com.


Re: [Rails] how do i send pictures in channels?

2020-01-19 Thread fugee ohu


On Sunday, January 19, 2020 at 4:56:19 PM UTC-5, Walter Lee Davis wrote:
>
>
>
> > On Jan 19, 2020, at 4:10 PM, fugee ohu > 
> wrote: 
> > 
> > Got my chat app working in rails 6 with channels but now how do I let 
> users send  pictures in channels? I've seen chat apps where after you 
> upload the picture it displays with a circled button that says send and you 
> can also delete it instead How do I do that? 
> > 
>
> With JavaScript. One of the neatest implementations I've seen of this is 
> in Trix (ActionText), which is open-source, so you could see how they do it 
> there. Also GitLab has a nice one, and the source is available for that 
> (unlike GitHub, who also have one). You're basically intercepting the drop 
> and paste events, checking to see whether the payload was an image, and 
> then doing some out-of-band trickery to make a file attachment using a 
> separate model and controller. Trix uses the new ActiveStorage goodies for 
> its implementation. Not sure what the others use. 
>
> Walter 
>
>
I'm using Trix I use this line to append to css selector in view from 
javascript channel but it doesn't render at all if I add an image to the 
form field with trix The content field is the trix field and it returns an 
object which is why I had to use data.content.body instead of just 
data.content 

   $('#message_holder').append('' + data.sender_name + 
'' + data.msg_time + '' + data.content.body + '');


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/4a5d3c8a-2acb-4581-b9e2-4d4e3f6db805%40googlegroups.com.


Re: [Rails] how do i send pictures in channels?

2020-01-19 Thread fugee ohu


On Sunday, January 19, 2020 at 4:56:19 PM UTC-5, Walter Lee Davis wrote:
>
>
>
> > On Jan 19, 2020, at 4:10 PM, fugee ohu > 
> wrote: 
> > 
> > Got my chat app working in rails 6 with channels but now how do I let 
> users send  pictures in channels? I've seen chat apps where after you 
> upload the picture it displays with a circled button that says send and you 
> can also delete it instead How do I do that? 
> > 
>
> With JavaScript. One of the neatest implementations I've seen of this is 
> in Trix (ActionText), which is open-source, so you could see how they do it 
> there. Also GitLab has a nice one, and the source is available for that 
> (unlike GitHub, who also have one). You're basically intercepting the drop 
> and paste events, checking to see whether the payload was an image, and 
> then doing some out-of-band trickery to make a file attachment using a 
> separate model and controller. Trix uses the new ActiveStorage goodies for 
> its implementation. Not sure what the others use. 
>
> Walter 
>

I already have a Picture model with polymorphic associations for different 
models that use it I'll use that 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/70b1541c-3045-4176-8ff0-68962d72c164%40googlegroups.com.


Re: [Rails] how do i send pictures in channels?

2020-01-19 Thread fugee ohu


On Sunday, January 19, 2020 at 4:56:19 PM UTC-5, Walter Lee Davis wrote:
>
>
>
> > On Jan 19, 2020, at 4:10 PM, fugee ohu > 
> wrote: 
> > 
> > Got my chat app working in rails 6 with channels but now how do I let 
> users send  pictures in channels? I've seen chat apps where after you 
> upload the picture it displays with a circled button that says send and you 
> can also delete it instead How do I do that? 
> > 
>
> With JavaScript. One of the neatest implementations I've seen of this is 
> in Trix (ActionText), which is open-source, so you could see how they do it 
> there. Also GitLab has a nice one, and the source is available for that 
> (unlike GitHub, who also have one). You're basically intercepting the drop 
> and paste events, checking to see whether the payload was an image, and 
> then doing some out-of-band trickery to make a file attachment using a 
> separate model and controller. Trix uses the new ActiveStorage goodies for 
> its implementation. Not sure what the others use. 
>
> Walter 
>
>
Having trouble loading actiontext.scss through application.scss
application.scss:
@import "actiontext";

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/8f75ecbb-3ff7-4f61-9b83-b9c03fc713cb%40googlegroups.com.


[Rails] how do i send pictures in channels?

2020-01-19 Thread fugee ohu
Got my chat app working in rails 6 with channels but now how do I let users 
send  pictures in channels? I've seen chat apps where after you upload the 
picture it displays with a circled button that says send and you can also 
delete it instead How do I do that?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/fe5cab8e-22d4-4d7f-8805-f831dbb68ad4%40googlegroups.com.


[Rails] actiontext.scss not loading

2020-01-19 Thread fugee ohu
application.scss

@import "actiontext.scss";

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/d5530717-43cc-4973-9369-b04c777b09a7%40googlegroups.com.


[Rails] where are these requests for images coming from?

2020-01-19 Thread fugee ohu
It seems I may have succeeded in importing something becuase webpacker is 
looking for all these image files Can someone explain to me what's going 
on? Seems to be looking for bootstrap and also actiontext image files?

Module not found: Error: Can't resolve '../img/play-pause.png' in 
'/home/fugee/data/websites/sitename/app/javascript/stylesheets'
resolve '../img/play-pause.png' in 
'/home/fugee/data/websites/sitename/app/javascript/stylesheets'
  using description file: /home/fugee/data/websites/sitename/package.json 
(relative path: ./app/javascript/stylesheets)



-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/b1daad84-3a3e-4a3f-980a-1bb5d86c6b37%40googlegroups.com.


[Rails] webpacker wants images under /app ?

2020-01-19 Thread fugee ohu
This is from app/javascript/application.js
// Uncomment to copy all static images under ../images to the output folder 
and reference
// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 
'rails.png' %>)
// or the `imagePath` JavaScript helper below.
//
// const images = require.context('../images', true)
// const imagePath = (name) => images(name, true)

As you can see the path to images isn't under javascript but in the same 
folder as the javascript folder, app because it has this line // const 
images = require.context('../images', true)
I thought images in webpacker are supposed to be under javascript as in 
app/javascript/assets/images
I have no src directory in my app I must have deleted it somewhere along 
the line? Should I replace it and use it for what?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/0216bb07-b308-4381-9981-a8b8573d9b4f%40googlegroups.com.


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

2020-01-18 Thread fugee ohu


On Saturday, January 18, 2020 at 11:11:11 AM UTC-5, Ariel Juodziukynas 
wrote:
>
> "//= 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 ( >) escribió:
>
>> I have my stylesheet in app/javascript/stylesheets and need to include 
>> actiontext.scss in application.scss where both files are located in 
>> app/javascript/stylesheets but using 
>> //= require actiontext has no effect, styling is still not being applied
>>
>> -- 
>> 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 rubyonra...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/rubyonrails-talk/58c1a214-6a7c-4b16-8e02-60a17cbb15d9%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/rubyonrails-talk/58c1a214-6a7c-4b16-8e02-60a17cbb15d9%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
Nothing in there about loaders I'm trying to get actiontext.scss to load I 
have listed in app/javascripts/packs/application.js
import "../stylesheets/actiontext.scss"
but the styling's  not being applied

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/55b87f6f-45e9-4f46-8c1b-b3bbfb4b6f41%40googlegroups.com.


[Rails] //= require stylesheet with webpacker

2020-01-17 Thread fugee ohu
I have my stylesheet in app/javascript/stylesheets and need to include 
actiontext.scss in application.scss where both files are located in 
app/javascript/stylesheets but using 
//= require actiontext has no effect, styling is still not being applied

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/58c1a214-6a7c-4b16-8e02-60a17cbb15d9%40googlegroups.com.


Re: [Rails] where do i put my production mail server settings?

2020-01-17 Thread fugee ohu


On Thursday, January 16, 2020 at 7:34:27 PM UTC-5, Walter Lee Davis wrote:
>
>
>
> > On Jan 16, 2020, at 6:19 PM, fugee ohu > 
> wrote: 
> > 
> > 
> > 
> > On Monday, December 30, 2019 at 2:48:06 PM UTC-5, Walter Lee Davis 
> wrote: 
> > 
> > 
> > > On Dec 29, 2019, at 11:44 PM, fugee ohu  wrote: 
> > > 
> > > I searched my entire tree starting at / for the name of my mail server 
> but didn't find it Everything's working it sends mail in production just 
> fine but I'm trying to figure out how, since it seems I never put the url 
> of my mail server anywhere? 
> > 
> > Your production server may be set up with postfix or sendmail, and thus 
> the default (SMTP to localhost) will Just Work™. When your application 
> sends mail, it just sends a raw SMTP message to port 25 on the localhost, 
> and the mail server running there accepts it and forwards it. That's the 
> default, baked into Rails, in case you don't configure anything more 
> specific. 
> > 
> > This is almost never what you actually want, because unless your 
> production Web server is also set up as an authoritative (DNS-verified) 
> SMTP server, your mail delivery will be spotty at best to large (think 
> Gmail) recipients. Those services take spam very seriously, and you have to 
> climb over some tall fences (configured in DNS, mainly, through TEXT and MX 
> records) in order to please them enough to accept your messages. 
> > 
> > This is doubly-true if your application is designed to send mail that is 
> "apparently-from" someone who is not at your server's domain. Services like 
> SendGrid exist to take this pain away from you, making sending 
> transactional e-mail as pain-free as possible, because they work to ensure 
> that their servers don't end up on banned lists, or get off them quickly. 
> > 
> > My recommendation if you want to send mail out to one user that appears 
> to be from another user, such that they can just hit "reply" in their mail 
> application and respond to it, send the message with the headers From: 
> a-real-...@your-server.com, and Reply-to: us...@example.com. That way the 
> message is deliverable (since it came from you, and you authenticate that 
> in your DNS settings), but the recipient can simply press Reply and not 
> have to manually correct the To: address in that message. 
> > 
> > Walter 
> > 
> > I found google was rejecting mail from my server because I didn't DKIM 
> and DMARC signatures setup After adding the services how do I ask google to 
> re-review my mail server if I'm not using gsuite? 
> > 
>
> I'm pretty sure it's done on a message-by-message basis. I doubt they 
> maintain a ban-list that you're on, and have to remove you from. Each 
> message purportedly "from" some other address is a new and special thing, 
> since headers are so very easy to forge. 
>

DKIM prevents spoofed sending 

>
> Walter 
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/b192aa9e-2ed5-4985-b7ae-d29345838bad%40googlegroups.com.


Re: [Rails] where do i put my production mail server settings?

2020-01-17 Thread fugee ohu


On Thursday, January 16, 2020 at 7:34:27 PM UTC-5, Walter Lee Davis wrote:
>
>
>
> > On Jan 16, 2020, at 6:19 PM, fugee ohu > 
> wrote: 
> > 
> > 
> > 
> > On Monday, December 30, 2019 at 2:48:06 PM UTC-5, Walter Lee Davis 
> wrote: 
> > 
> > 
> > > On Dec 29, 2019, at 11:44 PM, fugee ohu  wrote: 
> > > 
> > > I searched my entire tree starting at / for the name of my mail server 
> but didn't find it Everything's working it sends mail in production just 
> fine but I'm trying to figure out how, since it seems I never put the url 
> of my mail server anywhere? 
> > 
> > Your production server may be set up with postfix or sendmail, and thus 
> the default (SMTP to localhost) will Just Work™. When your application 
> sends mail, it just sends a raw SMTP message to port 25 on the localhost, 
> and the mail server running there accepts it and forwards it. That's the 
> default, baked into Rails, in case you don't configure anything more 
> specific. 
> > 
> > This is almost never what you actually want, because unless your 
> production Web server is also set up as an authoritative (DNS-verified) 
> SMTP server, your mail delivery will be spotty at best to large (think 
> Gmail) recipients. Those services take spam very seriously, and you have to 
> climb over some tall fences (configured in DNS, mainly, through TEXT and MX 
> records) in order to please them enough to accept your messages. 
> > 
> > This is doubly-true if your application is designed to send mail that is 
> "apparently-from" someone who is not at your server's domain. Services like 
> SendGrid exist to take this pain away from you, making sending 
> transactional e-mail as pain-free as possible, because they work to ensure 
> that their servers don't end up on banned lists, or get off them quickly. 
> > 
> > My recommendation if you want to send mail out to one user that appears 
> to be from another user, such that they can just hit "reply" in their mail 
> application and respond to it, send the message with the headers From: 
> a-real-...@your-server.com, and Reply-to: us...@example.com. That way the 
> message is deliverable (since it came from you, and you authenticate that 
> in your DNS settings), but the recipient can simply press Reply and not 
> have to manually correct the To: address in that message. 
> > 
> > Walter 
> > 
> > I found google was rejecting mail from my server because I didn't DKIM 
> and DMARC signatures setup After adding the services how do I ask google to 
> re-review my mail server if I'm not using gsuite? 
> > 
>
> I'm pretty sure it's done on a message-by-message basis. I doubt they 
> maintain a ban-list that you're on, and have to remove you from. Each 
> message purportedly "from" some other address is a new and special thing, 
> since headers are so very easy to forge. 
>
> Walter 
>
>
They keep adding things you have to do to not be rejected Now they want 
DKIM and DMARC setup  

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/ef547849-d093-44a0-a3ea-38ec0f253764%40googlegroups.com.


[Rails] How do I let users design their own blog with trix

2020-01-17 Thread fugee ohu
 I know how to use trix in a field but how do I let users design their 
entire page?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/a2d194ea-06f0-4e13-8606-c4d5dd8b3d81%40googlegroups.com.


Re: [Rails] where do i put my production mail server settings?

2020-01-16 Thread fugee ohu


On Monday, December 30, 2019 at 2:48:06 PM UTC-5, Walter Lee Davis wrote:
>
>
>
> > On Dec 29, 2019, at 11:44 PM, fugee ohu > 
> wrote: 
> > 
> > I searched my entire tree starting at / for the name of my mail server 
> but didn't find it Everything's working it sends mail in production just 
> fine but I'm trying to figure out how, since it seems I never put the url 
> of my mail server anywhere? 
>
> Your production server may be set up with postfix or sendmail, and thus 
> the default (SMTP to localhost) will Just Work™. When your application 
> sends mail, it just sends a raw SMTP message to port 25 on the localhost, 
> and the mail server running there accepts it and forwards it. That's the 
> default, baked into Rails, in case you don't configure anything more 
> specific. 
>
> This is almost never what you actually want, because unless your 
> production Web server is also set up as an authoritative (DNS-verified) 
> SMTP server, your mail delivery will be spotty at best to large (think 
> Gmail) recipients. Those services take spam very seriously, and you have to 
> climb over some tall fences (configured in DNS, mainly, through TEXT and MX 
> records) in order to please them enough to accept your messages. 
>
> This is doubly-true if your application is designed to send mail that is 
> "apparently-from" someone who is not at your server's domain. Services like 
> SendGrid exist to take this pain away from you, making sending 
> transactional e-mail as pain-free as possible, because they work to ensure 
> that their servers don't end up on banned lists, or get off them quickly. 
>
> My recommendation if you want to send mail out to one user that appears to 
> be from another user, such that they can just hit "reply" in their mail 
> application and respond to it, send the message with the headers From: 
> a-real-...@your-server.com , and Reply-to: us...@example.com 
> . That way the message is deliverable (since it came from 
> you, and you authenticate that in your DNS settings), but the recipient can 
> simply press Reply and not have to manually correct the To: address in that 
> message. 
>
> Walter


I found google was rejecting mail from my server because I didn't DKIM and 
DMARC signatures setup After adding the services how do I ask google to 
re-review my mail server if I'm not using gsuite?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/6df51ed6-1264-4b5a-997e-510605e633d5%40googlegroups.com.


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

2020-01-16 Thread fugee ohu


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 you 
> show it should work so something else is messing things up but you are 
> showing barely any relevant code.
>
> El mié., 15 ene. 2020 a las 22:37, fugee ohu ( >) 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 
>>> the id column
>>>
>>> Why don't you show your code, the stacktrace, the logs or anything? I 
>>> suggest you read something like stackoverflow's guidelines 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: 
>>>>> https://apidock.com/rails/v6.0.0/ActiveRecord/FinderMethods/find
>>>>>
>>>>> Person <https://apidock.com/rails/Person>.find 
>>>>> <https://apidock.com/rails/ActiveRecord/FinderMethods/find>("31-sarah") # 
>>>>> returns the object for ID = 31
>>>>>
>>>>> In your case, if you are using find, it should search for record with 
>>>>> id = 18
>>>>>
>>>>> El mié., 15 ene. 2020 a las 16:18, fugee ohu () 
>>>>> escribió:
>>>>>
>>>>>> Doesn't work for me in rails 6
>>>>>>
>>>>>>   Parameters: {"id"=>"18-test-title"}
>>>>>>  ActionController::ActionControllerError (Cannot redirect to nil!):
>>>>>>
>>>>>> Ne
>>>>>>
>>>>>> -- 
>>>>>> 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 rubyonra...@googlegroups.com.
>>>>>> To view this discussion on the web visit 
>>>>>> https://groups.google.com/d/msgid/rubyonrails-talk/64e66550-c393-43cd-8156-29c43139899a%40googlegroups.com
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/rubyonrails-talk/64e66550-c393-43cd-8156-29c43139899a%40googlegroups.com?utm_medium=email_source=footer>
>>>>>> .
>>>>>>
>>>>>
>>>> I've over-riding ActiveRecord to_param in my model
>>>>
>>>>   def to_param
>>>>"#{id}-#{title.parameterize}"
>>>>   end
>>>>
>>>> -- 
>>>> 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 rubyonra...@googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/rubyonrails-talk/1ba590e7-4c1c-4fcd-9ed8-0f2ed65b0350%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/rubyonrails-talk/1ba590e7-4c1c-4fcd-9ed8-0f2ed65b0350%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>>
>> I was trying to implement this guide:
>>
>> https://medium.com/badass-engineer/seo-friendly-urls-with-rails-49cfcd2fb190
>>
>> -- 
>> 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 rubyonra...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/rubyonrails-talk/1aa0ed3a-a906-4965-8ff1-c8fde1e909da%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/rubyonrails-talk/1aa0ed3a-a906-4965-8ff1-c8fde1e909da%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
So  what do you think is wrong with ensure_canonical_url ?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/3b7d9ae7-2326-4ee1-991f-6e791d3bb35b%40googlegroups.com.


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

2020-01-15 Thread fugee ohu
The error's caused by the routine ensure_canonical_url If I comment it out 
it works

blog_post.rb:

  def to_param
   "#{id}-#{title.parameterize}"
  end

blog_posts_controller.rb:

def set_blog_post
  @blog_post = BlogPost.find(params[:id])
end

def ensure_canonical_url
  redirect_to @blog_post if @blog_post.to_param != params[:id]
end


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 you 
> show it should work so something else is messing things up but you are 
> showing barely any relevant code.
>
> El mié., 15 ene. 2020 a las 22:37, fugee ohu ( >) 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 
>>> the id column
>>>
>>> Why don't you show your code, the stacktrace, the logs or anything? I 
>>> suggest you read something like stackoverflow's guidelines 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: 
>>>>> https://apidock.com/rails/v6.0.0/ActiveRecord/FinderMethods/find
>>>>>
>>>>> Person <https://apidock.com/rails/Person>.find 
>>>>> <https://apidock.com/rails/ActiveRecord/FinderMethods/find>("31-sarah") # 
>>>>> returns the object for ID = 31
>>>>>
>>>>> In your case, if you are using find, it should search for record with 
>>>>> id = 18
>>>>>
>>>>> El mié., 15 ene. 2020 a las 16:18, fugee ohu () 
>>>>> escribió:
>>>>>
>>>>>> Doesn't work for me in rails 6
>>>>>>
>>>>>>   Parameters: {"id"=>"18-test-title"}
>>>>>>  ActionController::ActionControllerError (Cannot redirect to nil!):
>>>>>>
>>>>>> Ne
>>>>>>
>>>>>> -- 
>>>>>> 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 rubyonra...@googlegroups.com.
>>>>>> To view this discussion on the web visit 
>>>>>> https://groups.google.com/d/msgid/rubyonrails-talk/64e66550-c393-43cd-8156-29c43139899a%40googlegroups.com
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/rubyonrails-talk/64e66550-c393-43cd-8156-29c43139899a%40googlegroups.com?utm_medium=email_source=footer>
>>>>>> .
>>>>>>
>>>>>
>>>> I've over-riding ActiveRecord to_param in my model
>>>>
>>>>   def to_param
>>>>"#{id}-#{title.parameterize}"
>>>>   end
>>>>
>>>> -- 
>>>> 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 rubyonra...@googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/rubyonrails-talk/1ba590e7-4c1c-4fcd-9ed8-0f2ed65b0350%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/rubyonrails-talk/1ba590e7-4c1c-4fcd-9ed8-0f2ed65b0350%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>>
>> I was trying to implement this guide:
>>
>> https://medium.com/badass-engineer/seo-friendly-urls-with-rails-49cfcd2fb190
>>
>> -- 
>> 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 rubyonra...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/rubyonrails-talk/1aa0ed3a-a906-4965-8ff1-c8fde1e909da%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/rubyonrails-talk/1aa0ed3a-a906-4965-8ff1-c8fde1e909da%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/36bef75c-1c04-4bdd-a43b-52194db1d431%40googlegroups.com.


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

2020-01-15 Thread fugee ohu


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 
> the id column
>
> Why don't you show your code, the stacktrace, the logs or anything? I 
> suggest you read something like stackoverflow's guidelines 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: 
>>> https://apidock.com/rails/v6.0.0/ActiveRecord/FinderMethods/find
>>>
>>> Person <https://apidock.com/rails/Person>.find 
>>> <https://apidock.com/rails/ActiveRecord/FinderMethods/find>("31-sarah") # 
>>> returns the object for ID = 31
>>>
>>> In your case, if you are using find, it should search for record with id 
>>> = 18
>>>
>>> El mié., 15 ene. 2020 a las 16:18, fugee ohu () 
>>> escribió:
>>>
>>>> Doesn't work for me in rails 6
>>>>
>>>>   Parameters: {"id"=>"18-test-title"}
>>>>  ActionController::ActionControllerError (Cannot redirect to nil!):
>>>>
>>>> Ne
>>>>
>>>> -- 
>>>> 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 rubyonra...@googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/rubyonrails-talk/64e66550-c393-43cd-8156-29c43139899a%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/rubyonrails-talk/64e66550-c393-43cd-8156-29c43139899a%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>>
>> I've over-riding ActiveRecord to_param in my model
>>
>>   def to_param
>>"#{id}-#{title.parameterize}"
>>   end
>>
>> -- 
>> 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 rubyonra...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/rubyonrails-talk/1ba590e7-4c1c-4fcd-9ed8-0f2ed65b0350%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/rubyonrails-talk/1ba590e7-4c1c-4fcd-9ed8-0f2ed65b0350%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
I was trying to implement this guide:
https://medium.com/badass-engineer/seo-friendly-urls-with-rails-49cfcd2fb190

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/1aa0ed3a-a906-4965-8ff1-c8fde1e909da%40googlegroups.com.


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

2020-01-15 Thread fugee ohu


On Wednesday, January 15, 2020 at 3:07:00 PM UTC-5, Ariel Juodziukynas 
wrote:
>
> From the docs: 
> https://apidock.com/rails/v6.0.0/ActiveRecord/FinderMethods/find
>
> Person <https://apidock.com/rails/Person>.find 
> <https://apidock.com/rails/ActiveRecord/FinderMethods/find>("31-sarah") # 
> returns the object for ID = 31
>
> In your case, if you are using find, it should search for record with id = 
> 18
>
> El mié., 15 ene. 2020 a las 16:18, fugee ohu ( >) escribió:
>
>> Doesn't work for me in rails 6
>>
>>   Parameters: {"id"=>"18-test-title"}
>>  ActionController::ActionControllerError (Cannot redirect to nil!):
>>
>> Ne
>>
>> -- 
>> 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 rubyonra...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/rubyonrails-talk/64e66550-c393-43cd-8156-29c43139899a%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/rubyonrails-talk/64e66550-c393-43cd-8156-29c43139899a%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
I've over-riding ActiveRecord to_param in my model

  def to_param
   "#{id}-#{title.parameterize}"
  end

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/1ba590e7-4c1c-4fcd-9ed8-0f2ed65b0350%40googlegroups.com.


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

2020-01-15 Thread fugee ohu
Doesn't work for me in rails 6

  Parameters: {"id"=>"18-test-title"}
 ActionController::ActionControllerError (Cannot redirect to nil!):

Ne

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/64e66550-c393-43cd-8156-29c43139899a%40googlegroups.com.


[Rails] google rejecting mail from my server

2020-01-14 Thread fugee ohu
I'm using my own mail server and it must be that google's rejecting my mail 
sent from no-reply address I see in my mail server's log that the messages 
are being sent and removed from the queue Does anyone else have this 
problem? I'm afraid to use services to send my mail because then they get 
all my users email addresses

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/d0c74286-ba32-46d0-803d-48cd78e80d95%40googlegroups.com.


Re: [Rails] syntax error in react file index.js

2020-01-13 Thread fugee ohu


On Monday, January 13, 2020 at 1:04:46 PM UTC-5, jake wrote:
>
> That looks like a babel problem, you are not transforming the jsx. Post 
> your babel config file.
>
> On Mon, Jan 13, 2020 at 10:20 AM fugee ohu  > wrote:
>
>> app/javascript/packs/index.js
>>
>> import React from 'react'
>> import ReactDom from 'react-dom'
>> import App from '../components/App'
>>
>> document.addEventListener('DOMContentLoaded', () => {
>>ReactDom.render(
>>   ,
>>   document.body.appendChild(document.createElement('div')),
>>)
>> })   
>>
>> I get this error:
>> SyntaxError: .../packs/index.js: Unexpected token (7:6)
>>
>> 5 | document.addEventListener('DOMContentLoaded', () => {
>> 6 |ReactDom.render(
>> >  7 |   ,
>>|   ^
>>
>> -- 
>> 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 rubyonra...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/rubyonrails-talk/24a278c2-d548-424c-adc2-730b687240bb%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/rubyonrails-talk/24a278c2-d548-424c-adc2-730b687240bb%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
I installed react using yarn I got it working by installing react with 
webpacker:install:react since webpacker is what I'm using makes more sense 
I guess, so also I guess I can remove the yarn react packages that I 
installed? 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/08f14316-ac33-41dc-a9ec-4984a6e13912%40googlegroups.com.


Re: [Rails] syntax error in react file index.js

2020-01-13 Thread fugee ohu


On Monday, January 13, 2020 at 1:04:46 PM UTC-5, jake wrote:
>
> That looks like a babel problem, you are not transforming the jsx. Post 
> your babel config file.
>
> On Mon, Jan 13, 2020 at 10:20 AM fugee ohu  > wrote:
>
>> app/javascript/packs/index.js
>>
>> import React from 'react'
>> import ReactDom from 'react-dom'
>> import App from '../components/App'
>>
>> document.addEventListener('DOMContentLoaded', () => {
>>ReactDom.render(
>>   ,
>>   document.body.appendChild(document.createElement('div')),
>>)
>> })   
>>
>> I get this error:
>> SyntaxError: .../packs/index.js: Unexpected token (7:6)
>>
>> 5 | document.addEventListener('DOMContentLoaded', () => {
>> 6 |ReactDom.render(
>> >  7 |   ,
>>|   ^
>>
>> -- 
>> 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 rubyonra...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/rubyonrails-talk/24a278c2-d548-424c-adc2-730b687240bb%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/rubyonrails-talk/24a278c2-d548-424c-adc2-730b687240bb%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
It was in node_modules

const { join, resolve } = require('path')
const { cache_path: cachePath, source_path: sourcePath, resolved_paths: 
resolvedPaths } = require('../config')
const { nodeEnv } = require('../env')

// Process application Javascript code with Babel.
// Uses application .babelrc to apply any transformations
module.exports = {
  test: /\.(js|jsx|mjs)?(\.erb)?$/,
  include: [sourcePath, ...resolvedPaths].map((p) => resolve(p)),
  exclude: /node_modules/,
  use: [
{
  loader: 'babel-loader',
  options: {
cacheDirectory: join(cachePath, 'babel-loader-node-modules'),
cacheCompression: nodeEnv === 'production',
compact: nodeEnv === 'production'
  }
}
  ]
}

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/0ee3e797-0119-4826-82d9-0e20bb20a6d2%40googlegroups.com.


Re: [Rails] syntax error in react file index.js

2020-01-13 Thread fugee ohu


On Monday, January 13, 2020 at 1:04:46 PM UTC-5, jake wrote:
>
> That looks like a babel problem, you are not transforming the jsx. Post 
> your babel config file.
>
> On Mon, Jan 13, 2020 at 10:20 AM fugee ohu  > wrote:
>
>> app/javascript/packs/index.js
>>
>> import React from 'react'
>> import ReactDom from 'react-dom'
>> import App from '../components/App'
>>
>> document.addEventListener('DOMContentLoaded', () => {
>>ReactDom.render(
>>   ,
>>   document.body.appendChild(document.createElement('div')),
>>)
>> })   
>>
>> I get this error:
>> SyntaxError: .../packs/index.js: Unexpected token (7:6)
>>
>> 5 | document.addEventListener('DOMContentLoaded', () => {
>> 6 |ReactDom.render(
>> >  7 |   ,
>>|   ^
>>
>> -- 
>> 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 rubyonra...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/rubyonrails-talk/24a278c2-d548-424c-adc2-730b687240bb%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/rubyonrails-talk/24a278c2-d548-424c-adc2-730b687240bb%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
Where should that file be located It isn't in config/webpack I installed 
react with `yarn add react react-dom` I never ran webpacker:install react 
and I'm not using the gem either 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/99e2b00a-19e4-4c33-8f17-f680052b0b6d%40googlegroups.com.


[Rails] syntax error in react file index.js

2020-01-13 Thread fugee ohu
app/javascript/packs/index.js

import React from 'react'
import ReactDom from 'react-dom'
import App from '../components/App'

document.addEventListener('DOMContentLoaded', () => {
   ReactDom.render(
  ,
  document.body.appendChild(document.createElement('div')),
   )
})   

I get this error:
SyntaxError: .../packs/index.js: Unexpected token (7:6)

5 | document.addEventListener('DOMContentLoaded', () => {
6 |ReactDom.render(
>  7 |   ,
   |   ^

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/24a278c2-d548-424c-adc2-730b687240bb%40googlegroups.com.


[Rails] Notify user of unread messages

2020-01-13 Thread fugee ohu
On my sn site I want users to know how many unread messages they have in 
the layout alongside the messages link I've got the messages system working 
with javascript channels and when messages are created and saved, or in 
plain English sent, my app/javascript/channels/room.js file is appending to 
the specified CSS selector of the view It works good without a lot of code 
Now to have the unread messages count displayed alongside the messages link 
in the layout I'm wondering how am I going to do this My first idea is 
react but looking at how much code react requires I'm thinking maybe this 
isn't the way to go, maybe there's a simpler way using the same room.js 
file to update messages link css selector in the layout ? 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/1c06a3d3-ba10-4c73-9a4e-44adbfdf595f%40googlegroups.com.


[Rails] Re: js-cookie

2020-01-10 Thread fugee ohu


On Saturday, January 11, 2020 at 1:48:31 AM UTC-5, fugee ohu wrote:
>
> I installed js-cookie using `yard add js-cookie and put this line in 
> application.js 
> require("js-cookie")
> but when I use this code in my channel:
> console.log(Cookies.get('current_user_id')) 
> I get the error Cookies is not defined
>

After placing <%= javascript_pack_tag 'js-cookie', 'data-turbolinks-track': 
'reload'   %>  in application.html.erb I get the error that it hasn't been 
included in manifest.js  

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/96743144-5c4d-497a-bb6f-4b79d4366b80%40googlegroups.com.


[Rails] Re: js-cookie

2020-01-10 Thread fugee ohu


On Saturday, January 11, 2020 at 1:48:31 AM UTC-5, fugee ohu wrote:
>
> I installed js-cookie using `yard add js-cookie and put this line in 
> application.js 
> require("js-cookie")
> but when I use this code in my channel:
> console.log(Cookies.get('current_user_id')) 
> I get the error Cookies is not defined
>

After running `yard install --check-files` it  errors out with not found in 
manifest.js

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/70c42ff9-2b17-47c2-9361-30d8070bb95e%40googlegroups.com.


[Rails] js-cookie

2020-01-10 Thread fugee ohu
I installed js-cookie using `yard add js-cookie and put this line in 
application.js 
require("js-cookie")
but when I use this code in my channel:
console.log(Cookies.get('current_user_id')) 
I get the error Cookies is not defined

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/37e95305-16e2-4ea1-8564-54ad42550e8a%40googlegroups.com.


[Rails] Re: How do I get the devise current_user in javascript

2020-01-09 Thread fugee ohu


On Thursday, January 9, 2020 at 1:53:52 AM UTC-5, Uzval Mallepeddi wrote:
>
> In application.rb file declare a before_action function that sets the 
> current_user into a cookie/session (cookie prefered). Then you can access 
> the cookies using "document.cookies" in javascript.
>
> On Wednesday, January 8, 2020 at 10:13:44 PM UTC-5, fugee ohu wrote:
>>
>> ?
>>
>
I also found this method on SO but the last line could be simplified by 
passing from controller current_user.id or current_user.name instead of the 
entire object

Application.js is not evaluated in the context of any session variables or 
methods. The simplest way to access username from javascript would be to 
set a cookie in a before_action on application controller:

class ApplicationController < ActionController::Base
  before_action :set_user

  private

  def set_user
cookies[:username] = current_user.name || 'guest'
  endend

Then from any js in app/assets you can access the cookie:

alert(document.cookie);

A more verbose but arguably cleaner method would be to create a route that 
accesses the current user and returns the username e.g. 

routes.rb

get 'current_user' => "users#current_user"

users_controller.rb

def current_user
render json: {name: current_user.name}end

application.js

$.get('/current_user', function(result){
  alert(result.name);});

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/9ec509cd-5b3a-460f-8f96-3de216566589%40googlegroups.com.


[Rails] How do I get the devise current_user in javascript

2020-01-08 Thread fugee ohu
?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/0d493ffc-504d-49c2-b5f0-df816adfc4ba%40googlegroups.com.


[Rails] Rails 6 Real time chat app

2020-01-07 Thread fugee ohu
I'm trying to learn how to build a chat app The youtube video titled "Rails 
6 - Real Time Chat App" https://www.youtube.com/watch?v=nRP91C1uX-w covers 
the basics but doesn't say how I can put each users own sent messages on 
the right side and the messages received from their chat partner on the 
left I've been fooling around with this a lot but still haven't figured it 
out Anyone can help?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/8d51c8b7-d3ad-465e-87a4-17603ab42ddc%40googlegroups.com.


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

2020-01-07 Thread fugee ohu


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 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 the language you are using, then each language takes care of 
> converting it.
>
> El dom., 5 ene. 2020 a las 4:35, fugee ohu ( >) escribió:
>
>> <%= content_tag :div, id: "message_holder", data: {conversation_with_id: @
>> conversation_with.id} do %>
>>
>> translates to this html from page source:
>>
>> 
>>
>> The underscores get translated to hyphens Should I just rename the variable 
>> to conversation-with-id ?
>>
>> -- 
>> 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 rubyonra...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/rubyonrails-talk/8da006ce-97eb-49d2-aa3f-b2226c8f0ef5%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/rubyonrails-talk/8da006ce-97eb-49d2-aa3f-b2226c8f0ef5%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
>> No, the first line is Ruby ... The second line is html 
Can you please show me the first and second lines that refers to, I see you 
gave me the answer but I forgot what was the question

Also when javascript is included on the html.erb page in 

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

2020-01-05 Thread fugee ohu


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 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 the language you are using, then each language takes care of 
> converting it.
>
> El dom., 5 ene. 2020 a las 4:35, fugee ohu ( >) escribió:
>
>> <%= content_tag :div, id: "message_holder", data: {conversation_with_id: @
>> conversation_with.id} do %>
>>
>> translates to this html from page source:
>>
>> 
>>
>> The underscores get translated to hyphens Should I just rename the variable 
>> to conversation-with-id ?
>>
>> -- 
>> 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 rubyonra...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/rubyonrails-talk/8da006ce-97eb-49d2-aa3f-b2226c8f0ef5%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/rubyonrails-talk/8da006ce-97eb-49d2-aa3f-b2226c8f0ef5%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
How are you able to reply after I've deleted my original post It's a 
pattern in here, whenever I delete a post I get a repsonse to a post that I 
already deleted It lends the impression that I've been deleting them after 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/cec31578-1a7e-47e3-ba2b-a7edfa50d98e%40googlegroups.com.


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

2020-01-05 Thread fugee ohu


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 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 the language you are using, then each language takes care of 
> converting it.
>
> El dom., 5 ene. 2020 a las 4:35, fugee ohu ( >) escribió:
>
>> <%= content_tag :div, id: "message_holder", data: {conversation_with_id: @
>> conversation_with.id} do %>
>>
>> translates to this html from page source:
>>
>> 
>>
>> The underscores get translated to hyphens Should I just rename the variable 
>> to conversation-with-id ?
>>
>> -- 
>> 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 rubyonra...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/rubyonrails-talk/8da006ce-97eb-49d2-aa3f-b2226c8f0ef5%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/rubyonrails-talk/8da006ce-97eb-49d2-aa3f-b2226c8f0ef5%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
In my case, since I used   `received(data) {`  do you mean dataset or data ?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/cc4dc30a-d0be-4df7-9ecb-450bc88669a1%40googlegroups.com.


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

2020-01-05 Thread fugee ohu


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 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 the language you are using, then each language takes care of 
> converting it.
>
> El dom., 5 ene. 2020 a las 4:35, fugee ohu ( >) escribió:
>
>> <%= content_tag :div, id: "message_holder", data: {conversation_with_id: @
>> conversation_with.id} do %>
>>
>> translates to this html from page source:
>>
>> 
>>
>> Camel case beginning with lower case? 

>
>> The underscores get translated to hyphens Should I just rename the variable 
>> to conversation-with-id ?
>>
>> -- 
>> 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 rubyonra...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/rubyonrails-talk/8da006ce-97eb-49d2-aa3f-b2226c8f0ef5%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/rubyonrails-talk/8da006ce-97eb-49d2-aa3f-b2226c8f0ef5%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/2c32a917-4ab1-4ee8-87cd-719d8a620622%40googlegroups.com.


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

2020-01-04 Thread fugee ohu
<%= content_tag :div, id: "message_holder", data: {conversation_with_id: 
@conversation_with.id} do %>

translates to this html from page source:



The underscores get translated to hyphens Should I just rename the variable to 
conversation-with-id ?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/8da006ce-97eb-49d2-aa3f-b2226c8f0ef5%40googlegroups.com.


Re: [Rails] where do i put my production mail server settings?

2020-01-04 Thread fugee ohu


On Monday, December 30, 2019 at 2:48:06 PM UTC-5, Walter Lee Davis wrote:
>
>
>
> > On Dec 29, 2019, at 11:44 PM, fugee ohu > 
> wrote: 
> > 
> > I searched my entire tree starting at / for the name of my mail server 
> but didn't find it Everything's working it sends mail in production just 
> fine but I'm trying to figure out how, since it seems I never put the url 
> of my mail server anywhere? 
>
> Your production server may be set up with postfix or sendmail, and thus 
> the default (SMTP to localhost) will Just Work™. When your application 
> sends mail, it just sends a raw SMTP message to port 25 on the localhost, 
> and the mail server running there accepts it and forwards it. That's the 
> default, baked into Rails, in case you don't configure anything more 
> specific. 
>
> This is almost never what you actually want, because unless your 
> production Web server is also set up as an authoritative (DNS-verified) 
> SMTP server, your mail delivery will be spotty at best to large (think 
> Gmail) recipients. Those services take spam very seriously, and you have to 
> climb over some tall fences (configured in DNS, mainly, through TEXT and MX 
> records) in order to please them enough to accept your messages. 
>
> This is doubly-true if your application is designed to send mail that is 
> "apparently-from" someone who is not at your server's domain. Services like 
> SendGrid exist to take this pain away from you, making sending 
> transactional e-mail as pain-free as possible, because they work to ensure 
> that their servers don't end up on banned lists, or get off them quickly. 
>
> My recommendation if you want to send mail out to one user that appears to 
> be from another user, such that they can just hit "reply" in their mail 
> application and respond to it, send the message with the headers From: 
> a-real-...@your-server.com , and Reply-to: us...@example.com 
> . That way the message is deliverable (since it came from 
> you, and you authenticate that in your DNS settings), but the recipient can 
> simply press Reply and not have to manually correct the To: address in that 
> message. 
>
> Walter


I'm running a mail server, (on another machine at another ip address) I'll 
configure my sites to use it 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/01a51c8a-e4d7-4fa0-b9ee-0f8b2082704d%40googlegroups.com.


[Rails] how do i know what ruby version my site was built with

2020-01-04 Thread fugee ohu
If I didn't specify a ruby version in my Gemfile

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/e99e2314-18b1-4056-8a41-043154d4ff91%40googlegroups.com.


Re: [Rails] activerecord wrong number of arguments 3 given 0..2 expected

2020-01-03 Thread fugee ohu


On Thursday, January 2, 2020 at 7:15:40 PM UTC-5, hasan...@gmail.com wrote:
>
> To set strict_mode on MySQL in rails, the knob you want is `strict: false`
>
>
> On Thu, 2 Jan 2020 at 16:06, fugee ohu > 
> wrote:
>
>> I'm thinking I'm getting this is because of mysql sql_mode traditional vs 
>> strict When I run select @@sql_mode on mysql console it returns a list of 
>> modes which include TRADITIONAL somewhere in the middle of the list
>>
>> database.yml
>>
>> default: 
>>   adapter: mysql2
>>   encoding: utf8
>>   pool: 5
>>   socket: /var/run/mysqld/mysqld.sock
>>
>>
>> development:
>>   <<: *default
>>   database: mydb_development
>>   username: myusername
>>   password: mypassword
>>   sql_mode: TRADITIONAL
>>
>> -- 
>> 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 rubyonra...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/rubyonrails-talk/7349aa08-8212-4c18-981e-fb1412e8118d%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/rubyonrails-talk/7349aa08-8212-4c18-981e-fb1412e8118d%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
>
> -- 
> OpenPGP: 
> https://sks-keyservers.net/pks/lookup?op=get=0xFEBAD7FFD041BBA1
> If you wish to request my time, please do so using 
> *bit.ly/hd1AppointmentRequest 
> <http://bit.ly/hd1AppointmentRequest>*.
> Si vous voudrais faire connnaisance, allez a *bit.ly/hd1AppointmentRequest 
> <http://bit.ly/hd1AppointmentRequest>*.
>
> <https://sks-keyservers.net/pks/lookup?op=get=0xFEBAD7FFD041BBA1>Sent 
> from my mobile device
> Envoye de mon portable
>

Thanks   I found the cause of the error by running `rake 
assets:precompile`, I had an extra option that didn't belong in 
app/assets/config/manifest.js I had put //= link_directory ../stylesheets 
.css .scss where it will only only one option I reverted to //= 
link_directory ../stylesheets .css to solve

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/8c149971-58f1-4a8f-a4c1-668913ee493c%40googlegroups.com.


[Rails] activerecord wrong number of arguments 3 given 0..2 expected

2020-01-02 Thread fugee ohu
I'm thinking I'm getting this is because of mysql sql_mode traditional vs 
strict When I run select @@sql_mode on mysql console it returns a list of 
modes which include TRADITIONAL somewhere in the middle of the list

database.yml

default: 
  adapter: mysql2
  encoding: utf8
  pool: 5
  socket: /var/run/mysqld/mysqld.sock


development:
  <<: *default
  database: mydb_development
  username: myusername
  password: mypassword
  sql_mode: TRADITIONAL

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/7349aa08-8212-4c18-981e-fb1412e8118d%40googlegroups.com.


[Rails] activerecord template error wrong number of arguments given 3 expected 0-2

2020-01-01 Thread fugee ohu
My app causes this error I though it might be my database adapter gem so I 
changed the version of mysql2 in my gemfile,  and ran bundle, then I got 
the error
Specified 'mysql2' for database adapter, but the gem is not loaded. Add 
`gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum 
required by ActiveRecord).


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/5c3be4de-c919-48bb-8490-3de7b81c9368%40googlegroups.com.


[Rails] Re: jquery css styling not being applied when appending to the dom

2019-12-31 Thread fugee ohu


On Monday, December 30, 2019 at 4:52:46 PM UTC-5, Sampson Crowley wrote:
>
> there are a massive number of possible reasons. you really should do some 
> research on css display types, as I'm assuming `right` is supposed to be a 
> element with "float: right" but "span" tags don't respond to floats unless 
> they have been set as block-level elements
>
> On Tuesday, December 24, 2019 at 7:07:32 PM UTC-7, fugee ohu wrote:
>>
>> $('#message_holder').append('' 
>> + data.content + '')
>>
>> The string gets appended to the message_holder div like so:
>>
>> 9
>>
>> but the styling defined in .right doesn't get applied What to do?
>>
>>
 Actually I think my problem is in the content_tag in my view I could 
rewrite it as html but I may as well get this right the rails way Presently 
the problem is  data-conversation_with_id isn't being passed to the 
javascript

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/0dabe4ca-180b-47e3-8769-a36177a1da35%40googlegroups.com.


[Rails] Re: jquery css styling not being applied when appending to the dom

2019-12-31 Thread fugee ohu


On Monday, December 30, 2019 at 4:52:46 PM UTC-5, Sampson Crowley wrote:
>
> there are a massive number of possible reasons. you really should do some 
> research on css display types, as I'm assuming `right` is supposed to be a 
> element with "float: right" but "span" tags don't respond to floats unless 
> they have been set as block-level elements
>
> On Tuesday, December 24, 2019 at 7:07:32 PM UTC-7, fugee ohu wrote:
>>
>> $('#message_holder').append('' 
>> + data.content + '')
>>
>> The string gets appended to the message_holder div like so:
>>
>> 9
>>
>> but the styling defined in .right doesn't get applied What to do?
>>
>>

view:
Conversation with <%= @conversation_with.name %>
<%= content_tag :div, id: "message_holder", data: {conversation_with_id: 
@conversation_with.id} do %>

   <% @messages.each do |m| %>
<% if m.sender==@conversation_with.id %>
<%= m.content %>
<% else %>
<%= m.content %>
<% end %>
<% end %>

<% end %>

js:

 received(data) {

if 
(data.sender==$('#message_holder').data-conversation_with_id) 
   {
   $('#message_holder').append('' + 
data.content +  '');
   }
else 
   {
   $('#message_holder').append('' 
+ data.content + 'converation_with_id:'  +  '');
   }

  }
});

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/2ab75cf8-3ebd-4aa9-9450-83d37d5c27fa%40googlegroups.com.


[Rails] Re: jquery css styling not being applied when appending to the dom

2019-12-31 Thread fugee ohu


On Monday, December 30, 2019 at 4:52:46 PM UTC-5, Sampson Crowley wrote:
>
> there are a massive number of possible reasons. you really should do some 
> research on css display types, as I'm assuming `right` is supposed to be a 
> element with "float: right" but "span" tags don't respond to floats unless 
> they have been set as block-level elements
>
> On Tuesday, December 24, 2019 at 7:07:32 PM UTC-7, fugee ohu wrote:
>>
>> $('#message_holder').append('' 
>> + data.content + '')
>>
>> The string gets appended to the message_holder div like so:
>>
>> 9
>>
>> but the styling defined in .right doesn't get applied What to do?
>>
>>
>>
  received(data) {

if 
(data.sender==$('#message_holder').data('conversation_with_id')) 
   {
   $('#message_holder').append('' + 
data.content + '');
   }
else 
   {
   $('#message_holder').append('' 
+ data.content + '');
   }

  }
});

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/99c5ee02-3ef1-4ff5-a7ac-6461c33e4fd9%40googlegroups.com.


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

2019-12-31 Thread fugee ohu
Beginning with what rails version is this path expected to exist?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/134e419e-b25a-4251-8aff-3cee2fb94f24%40googlegroups.com.


[Rails] where do i put my production mail server settings?

2019-12-29 Thread fugee ohu
I searched my entire tree starting at / for the name of my mail server but 
didn't find it Everything's working it sends mail in production just fine 
but I'm trying to figure out how, since it seems I never put the url of my 
mail server anywhere?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/9c10c3ba-8f89-44e1-ad7f-7a1fa01dd31d%40googlegroups.com.


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

2019-12-28 Thread fugee ohu


On Thursday, December 26, 2019 at 6:17:23 PM UTC-5, Cédric Lefebvre wrote:
>
> I have deployed devise & devise-i18n to internationalize devise. 
> Everything works well - including all the i18n - except that flash messages 
> generated by devise do not get translated
>
> => messages generated by devise and accessed via 
> resource.errors.full_messages are localized
> e.g. try to "sign_up" with no information filled in
>
>
> => flashes generated by devise are not localized
> e.g. try to "sign_in" with no information filled in
>
>
> Any idea why? Any idea on how to fix this?
>

Have you created settings for i18n in application.rb ?

Here's what application.rb looks like on one of my sites that uses locales:
Rails.application.config.i18n.available_locales = ["ko", "zh-TW", "ja", 
"en-US"]
Rails.application.config.i18n.default_locale = "en-US"
ISO3166.configure do |config|
   config.locales = ['zh-TW', 'en-US', 'ko', 'ja']

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/526f03ab-5181-45e1-9a8d-622e1ec17fb6%40googlegroups.com.


[Rails] webpacker strange behavior; things don't update until I restart my computer

2019-12-28 Thread fugee ohu
I get very strange behavior from webpacker If something works then I change 
it, then it's broken so I undo my changes and save the file back the way it 
was, now things are still broken and stay broken until I restart my 
computer Have tried clearing browser cache, restarting webpack-dev-server, 
restarting Puma but only restarting my computer gets things working again

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/2c9d678c-89f2-4383-bb38-db73dd6f5a8b%40googlegroups.com.


[Rails] elasticsearch-lite

2019-12-25 Thread fugee ohu
i ran `yarn add elasticsearch-lite` and then `PORT=9200 
node_modules/.bin/elasticsearch`
internal/modules/cjs/loader.js:638
throw err;
^

Error: Cannot find module 'worker_threads'

I'm doing this because my laptop can't handle elasticsearch

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/95d5d785-7e39-4db4-8d54-1831ea9265e3%40googlegroups.com.


[Rails] jquery css styling not being applied when appending to the dom

2019-12-24 Thread fugee ohu
$('#message_holder').append('' + 
data.content + '')

The string gets appended to the message_holder div like so:

9

but the styling defined in .right doesn't get applied What to do?


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/1274198e-b20c-4c84-8a0a-461bf4a68d27%40googlegroups.com.


[Rails] create chat view

2019-12-24 Thread fugee ohu
I'm trying to create a chat view where if the sender of the message is the 
current user then the message is displayed on the right side and if the 
sender is the other user then the message is displayed on the left So far 
what I have doesn't right or left float the messages, they all appear in 
the same column

chat.html.erb:


Conversation with <%= @conversation_with.name %>


<% @messages.each do |m| %>
<% if m.sender=@conversation_with %>
<%= m.content %>
<% else %>
<%= m.content %>
<% end %>
<% end %>


application.scss:

.left-float
{
float: left;
}

.right-float
{
float: right;
}


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/5cee16be-a1df-4748-b842-7bfab60c9e5c%40googlegroups.com.


[Rails] element for styling text

2019-12-24 Thread fugee ohu
I have elements like <%= m.content %> where m stands for message as I 
iterate through @messages How do I style them since I haven't defined them 
as any type of element

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/0e318fd1-a025-447d-a2b6-9515b48fbada%40googlegroups.com.


[Rails] error using will_paginate with mailboxer

2019-12-23 Thread fugee ohu
I removed the box param from conversations because I'm trying to show 
conversations in a chat type view meaning not have inbox, sent, trash 
available for the user So I get the error "
undefined method `paginate' for #https://groups.google.com/d/msgid/rubyonrails-talk/02af6439-3d28-480f-a448-78408b51c92e%40googlegroups.com.


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

2019-12-23 Thread fugee ohu


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 packs folder webpacker will create bundles using 
> those files, if you put them elsewhere wenpacker will bundle them inside 
> the packs that require them.
>
> El dom., 22 dic. 2019 a las 4:48, fugee ohu ( >) escribió:
>
>> Where do I put my custom javascript files now, under javascripts or under 
>> javascripts/packs or should i create a directory like 'custom' under 
>> javascripts and then in javascript/packs/application.js i would have to 
>> import "../custom" and that would import all the javascript files in the 
>> custom directory Can someone please clarify? 
>>
>> -- 
>> 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 rubyonra...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/rubyonrails-talk/8295b70b-e09e-4fe3-96ba-cb5017125ace%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/rubyonrails-talk/8295b70b-e09e-4fe3-96ba-cb5017125ace%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
wenpacker will bundle them inside the packs that require them
What does that mean?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/b479f7ff-e3ce-4337-bd94-12042605bc84%40googlegroups.com.


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

2019-12-22 Thread fugee ohu


On Sunday, December 22, 2019 at 6:05:15 PM UTC-5, Ariel Juodziukynas wrote:
>
> 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 questions about webpacker for images and 
> CSS, you don't really HAVE to change from Sprockets to Webpacker to update 
> to rails 6, in fact, if you start a new rails app, it uses webpacker only 
> for javascript assets, it's still using sprockets for css and images by 
> default. Of course you are free to use webpacker for everything but maybe 
> you have to follow webpack guidelines and start messing with loaders, check 
> the webpack guide on packing images and using it for background image for 
> example https://webpack.js.org/guides/asset-management/#loading-images
>
> El dom., 22 dic. 2019 a las 17:12, fugee ohu ( >) escribió:
>
>> Webpacker is serving images in views, I just don't know how to do it in 
>> css
>>
>> -- 
>> 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 rubyonra...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/rubyonrails-talk/549cd10d-f440-4ca0-a3a5-51748c623e92%40googlegroups.com
>> .
>>
>
I saw one post where someone suggests renaming javascripts to "webpacker" 
and then creating javascripts and images folders under "webpacker" Wanna 
get a good handle on being able to put assets wherever I want

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/bd10518a-c532-42d0-ae2d-59818ea12874%40googlegroups.com.


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

2019-12-22 Thread fugee ohu


On Sunday, December 22, 2019 at 6:05:15 PM UTC-5, Ariel Juodziukynas wrote:
>
> 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 questions about webpacker for images and 
> CSS, you don't really HAVE to change from Sprockets to Webpacker to update 
> to rails 6, in fact, if you start a new rails app, it uses webpacker only 
> for javascript assets, it's still using sprockets for css and images by 
> default. Of course you are free to use webpacker for everything but maybe 
> you have to follow webpack guidelines and start messing with loaders, check 
> the webpack guide on packing images and using it for background image for 
> example https://webpack.js.org/guides/asset-management/#loading-images
>
> El dom., 22 dic. 2019 a las 17:12, fugee ohu ( >) escribió:
>
>> Webpacker is serving images in views, I just don't know how to do it in 
>> css
>>
>> -- 
>> 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 rubyonra...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/rubyonrails-talk/549cd10d-f440-4ca0-a3a5-51748c623e92%40googlegroups.com
>> .
>>
>
Yea I know but I already see people saying why use both Also I wanna get 
used to this This is the first technology I'm getting in on the ground 
floor I feel, the time to learn/get used to using webpacker is now Moving 
all assets to webpacker is good practice for me Also using 
webpack-dev-server is a step forward, as soon as you save a file it 
recompiles and you get rewarded for doing something right when you save the 
file and the screen lights up green like a pinball machine rewards you for 
scoring

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/8fe59f11-ae63-4533-80bd-8334cce04738%40googlegroups.com.


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

2019-12-22 Thread fugee ohu


On Sunday, December 22, 2019 at 6:12:50 PM UTC-5, Ariel Juodziukynas wrote:
>
> 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 says to use:
>>
>> 
>> But in my views I've been using
>>  
>> The code is a little different, I have to try it out, but the question is 
>> the same Is applying the class to the div the same as not using the div for 
>> bootstrap purposes
>>
>> -- 
>> 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 rubyonra...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/rubyonrails-talk/f79a4675-30bd-4527-872f-f65badb78d5b%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/rubyonrails-talk/f79a4675-30bd-4527-872f-f65badb78d5b%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/990f1ce9-6309-4a5b-ae09-c152b2b93be1%40googlegroups.com.


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

2019-12-22 Thread fugee ohu


On Sunday, December 22, 2019 at 1:50:09 PM UTC-5, Siyanda Maphumulo wrote:
>
> in the file app/assets/config/manifest.js
>
> //= link_tree ../images
> //= link application.css
>
> I have images in app/assets/images/
>
> background-image: url(image_path("bg/main.jpg"));
>
>
> So this is similar to the way you would access images in previous versions 
> of Rails, the linking of those assets is being handled by sprockets and not 
> webpacker.
>  
>
> On Sunday, 22 December 2019 20:27:45 UTC+2, fugee ohu wrote:
>>
>>
>>
>> On Sunday, December 22, 2019 at 11:12:28 AM UTC-5, Siyanda Maphumulo 
>> wrote:
>>>
>>> .search_button
>>> {
>>>   background:url(image_path("search.png"));
>>> }
>>>
>>> more information : https://guides.rubyonrails.org/asset_pipeline.html
>>>
>>> On Sunday, 22 December 2019 17:15:59 UTC+2, fugee ohu wrote:
>>>>
>>>> How do I refer to images in stylesheets with rails 6/webpacker I always 
>>>> get can't resolve image.png from code like this:
>>>> .search_button
>>>>
>>>> .search_button
>>>> {
>>>>   background:url(search.png);
>>>> }
>>>>
>>>
>> Not 
>> First, where should I put images Then, how to access them from 
>> app/javascripts/stylesheets/application.scss
>>
>
Sorry I mis-spelled the file name It's emitting now but not rendering I 
think my html is wrong

 <%= submit_tag "Search", class: submit_button %> 

.search_button
{
background-image: url('../images/search-button.png');
}

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/ba62b7e5-6ba5-4f43-b0df-f981349cea6f%40googlegroups.com.


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

2019-12-22 Thread fugee ohu


On Sunday, December 22, 2019 at 10:15:59 AM UTC-5, fugee ohu wrote:
>
> How do I refer to images in stylesheets with rails 6/webpacker I always 
> get can't resolve image.png from code like this:
> .search_button
>
> .search_button
> {
>   background:url(search.png);
> }
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/cee5b70f-d5c1-40ad-b5f9-91ebd68f50b6%40googlegroups.com.


Re: [Rails] webpacker images folder

2019-12-22 Thread fugee ohu


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 
> 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, fugee ohu ( >) escribió:
>
>> If I put in application.js require.context('../images', true) everything 
>> works fine regardless of whether I place my images folder under javascripts 
>> or under javascripts/packs If I have my image folder under packs and change 
>> it to require.context('images', true) it breaks
>>
>> -- 
>> 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 rubyonra...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/rubyonrails-talk/acaa913d-e589-4c10-af28-7488d2777f77%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/rubyonrails-talk/acaa913d-e589-4c10-af28-7488d2777f77%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
Actually have all my js files inside packs for now Where should I put those 
Note: original question was about images

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/4d2ca96e-903e-4182-baea-d6f0f0b815de%40googlegroups.com.


[Rails] bootstrap nav vs div class: nav

2019-12-22 Thread fugee ohu
Documentation says to use:


But in my views I've been using
 
The code is a little different, I have to try it out, but the question is the 
same Is applying the class to the div the same as not using the div for 
bootstrap purposes

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/f79a4675-30bd-4527-872f-f65badb78d5b%40googlegroups.com.


  1   2   3   4   5   6   7   8   9   10   >