Ruby on Rails Friday, June 28, 2019

Have you tried the --verbose option when you run the command? it should give you some information of all the steps that the command executes.

El vie., 28 jun. 2019 a las 7:15, Harold Alcalde Solarte (<haroldalcaldesolarte@gmail.com>) escribió:
Blank space is an error when copying.
The command works I use the same command with another repository smaller than this, I was thinking if it's something of the response time or the timeout, but I can not find anything.

El jueves, 27 de junio de 2019, 15:39:41 (UTC+2), Ariel Juodziukynas escribió:
You have no blank space between USER and "--password". Also add the option "--verbose" to the comend to see more info of the request. Are you sure the command works? I mean, I don't see how it's related to ruby nor rubyonrails.

El jue., 27 jun. 2019 a las 10:12, Harold Alcalde Solarte (<haroldalca...@gmail.com>) escribió:
Hi all,

I am trying to create in my APP a tree of directories from the data of the SVN repository. My app is on Windows and the repository I'm trying to access on another Linux server.
I'm using the command to get all the files and folders:

'svn list -R http://172.xx.xx.xx/repos/Ttest/ --trust-server-cert --non-interactive --username USER--password PASSWORD'

When I execute the command it doesnt do anything and once the execution is cut, the following error is shown:


svn: E200015: Se atrapó una señal
svn: E200015: Se atrapó una señal
svn: E200015: Se atrapó una señal
svn: E170013: Unable to connect to a repository at URL 'http://172.xx.xx.xx/repos/Ttest/test1.txt'
svn: E200015: Se atrapó una señal
svn: E200015: Se atrapó una señal


I have searched for those errors but I can not find a solution.

Any suggestions?

--
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 post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c94a665a-ae09-4cea-a452-3cbc5a9eaf80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

Ruby on Rails

Blank space is an error when copying.
The command works I use the same command with another repository smaller than this, I was thinking if it's something of the response time or the timeout, but I can not find anything.

El jueves, 27 de junio de 2019, 15:39:41 (UTC+2), Ariel Juodziukynas escribió:
You have no blank space between USER and "--password". Also add the option "--verbose" to the comend to see more info of the request. Are you sure the command works? I mean, I don't see how it's related to ruby nor rubyonrails.

El jue., 27 jun. 2019 a las 10:12, Harold Alcalde Solarte (<haroldalca...@gmail.com>) escribió:
Hi all,

I am trying to create in my APP a tree of directories from the data of the SVN repository. My app is on Windows and the repository I'm trying to access on another Linux server.
I'm using the command to get all the files and folders:

'svn list -R http://172.xx.xx.xx/repos/Ttest/ --trust-server-cert --non-interactive --username USER--password PASSWORD'

When I execute the command it doesnt do anything and once the execution is cut, the following error is shown:


svn: E200015: Se atrapó una señal
svn: E200015: Se atrapó una señal
svn: E200015: Se atrapó una señal
svn: E170013: Unable to connect to a repository at URL 'http://172.xx.xx.xx/repos/Ttest/test1.txt'
svn: E200015: Se atrapó una señal
svn: E200015: Se atrapó una señal


I have searched for those errors but I can not find a solution.

Any suggestions?

--
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 post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c94a665a-ae09-4cea-a452-3cbc5a9eaf80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

Ruby on Rails Thursday, June 27, 2019

Of course. Thank you.

On Thursday, 27 June 2019 14:08:46 UTC+1, Ariel Juodziukynas wrote:
Just define your own partial in your app's app/view folder and it will be used instead of that default partial.

El jue., 27 jun. 2019 a las 6:54, Ben Walsh (<ben....@bonkers.ie>) escribió:
This behaviour is hard-coded in app/views/action_text/content/_layout.html.erb

I think it should be possible to customize the wrapper element -- the current behaviour breaks backwards compatibility for us when migrating from TinyMCE to 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 rubyonra...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/db62688d-2bbd-4be8-8697-fd0ab3df127a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

Ruby on Rails

You have no blank space between USER and "--password". Also add the option "--verbose" to the comend to see more info of the request. Are you sure the command works? I mean, I don't see how it's related to ruby nor rubyonrails.

El jue., 27 jun. 2019 a las 10:12, Harold Alcalde Solarte (<haroldalcaldesolarte@gmail.com>) escribió:
Hi all,

I am trying to create in my APP a tree of directories from the data of the SVN repository. My app is on Windows and the repository I'm trying to access on another Linux server.
I'm using the command to get all the files and folders:

'svn list -R http://172.xx.xx.xx/repos/Ttest/ --trust-server-cert --non-interactive --username USER--password PASSWORD'

When I execute the command it doesnt do anything and once the execution is cut, the following error is shown:


svn: E200015: Se atrapó una señal
svn: E200015: Se atrapó una señal
svn: E200015: Se atrapó una señal
svn: E170013: Unable to connect to a repository at URL 'http://172.xx.xx.xx/repos/Ttest/test1.txt'
svn: E200015: Se atrapó una señal
svn: E200015: Se atrapó una señal


I have searched for those errors but I can not find a solution.

Any suggestions?

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c94a665a-ae09-4cea-a452-3cbc5a9eaf80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

Ruby on Rails

Just define your own partial in your app's app/view folder and it will be used instead of that default partial.

El jue., 27 jun. 2019 a las 6:54, Ben Walsh (<ben.walsh@bonkers.ie>) escribió:
This behaviour is hard-coded in app/views/action_text/content/_layout.html.erb

I think it should be possible to customize the wrapper element -- the current behaviour breaks backwards compatibility for us when migrating from TinyMCE to 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+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/db62688d-2bbd-4be8-8697-fd0ab3df127a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

Ruby on Rails

Hi all,

I am trying to create in my APP a tree of directories from the data of the SVN repository. My app is on Windows and the repository I'm trying to access on another Linux server.
I'm using the command to get all the files and folders:

'svn list -R http://172.xx.xx.xx/repos/Ttest/ --trust-server-cert --non-interactive --username USER--password PASSWORD'

When I execute the command it doesnt do anything and once the execution is cut, the following error is shown:


svn: E200015: Se atrapó una señal
svn: E200015: Se atrapó una señal
svn: E200015: Se atrapó una señal
svn: E170013: Unable to connect to a repository at URL 'http://172.xx.xx.xx/repos/Ttest/test1.txt'
svn: E200015: Se atrapó una señal
svn: E200015: Se atrapó una señal


I have searched for those errors but I can not find a solution.

Any suggestions?

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c94a665a-ae09-4cea-a452-3cbc5a9eaf80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

This behaviour is hard-coded in app/views/action_text/content/_layout.html.erb

I think it should be possible to customize the wrapper element -- the current behaviour breaks backwards compatibility for us when migrating from TinyMCE to 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+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/db62688d-2bbd-4be8-8697-fd0ab3df127a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails Wednesday, June 26, 2019

Assuming you had a states_controller.rb that had a show method in it that looked something like this:

def show
@state = State.find params[:id]
render partial: 'cities_picker', layout: false
end

you could have a views/states/_cities_picker.html.erb that looked like this:

<%= select_tag('address[city_id]', options_from_collection_for_select(@state.cities, :id, :name)) %>

That's all you would need to make a fully populated picker with

<select name="address[city_id]">
<option value="1">Aliquippa</option>
<option value="2">Allentown</option>
...
<option value="60">York<.option>
</select>

That's assuming you have the data set up and populated so you know that these are the cities in Pennsylvania. You'd possibly put a label or some other HTML in there, but if you were swapping out this form element for one populated with the cities of Ohio, then you'd probably what to move as little around as necessary, and just leave the label and any structural HTML untouched in the parent page.

Walter

> On Jun 25, 2019, at 11:18 PM, David Merrick <merrickdav@gmail.com> wrote:
>
> HI What would the render partial: 'cities_picker', layout: false look like in your example?
>
> On Fri, May 31, 2019 at 2:25 PM Walter Lee Davis <waltd@wdstudio.com> wrote:
> What do the pickers mean? What values are they representing? When you choose one picker value, why does another picker need a different set of values to appear? If you can explain how you have modeled that part of your data, then I can help you further. In principle, a controller (any controller) can handle requests related to any model. It's just a convention that if you have a model Foo, you will have a FoosController to handle requests related to that model.
>
> Here's a practical example of how you might use this sort of cascading picker:
>
> class Country < ApplicationRecord
> has_many :states
> end
>
> class State < ApplicationRecord
> belongs_to :country
> has_many :cities
> end
>
> class City < ApplicationRecord
> belongs_to :state
> end
>
> You have a natural cascade of country to state to city, and it makes sense what those relationships are. The relationships are codified with the has_many and belongs_to macros, so it's clear that if you say @state.cities, you will get the cities that exist inside that state. You would do that by establishing what the parent id is in each child record. You might have Arizona as @state id = 1, and then have a bunch of cities like Phoenix: @city id = 22, state_id = 1, so you can gather them up.
>
> So you have choices now as to choosing a controller pattern. The REST design says that you should have a separate controller for each model, and so that could go like this:
>
> class CountriesController < ApplicationController
> def index
> @countries = Country.order(:name)
> render partial: 'countries_picker', layout: false
> end
>
> def show
> country = Country.find params[:id]
> @states = @country.states.order(:name)
> render partial: 'states_picker', layout: false
> end
> end
>
> class StatesController < ApplicationController
> def show
> state = State.find params[:id]
> @cities = @state.cities.order(:name)
> render partial: 'cities_picker', layout: false
> end
> end
>
> Your routes would look like this
>
> resources :countries, only: [:index, :show]
> resources :states, only: :show
>
> If you wanted to have a single controller concerned with making these pickers (and ignore the whole REST thing), then you could have:
>
> class PickersController < ApplicationController
> def countries
> @countries = Country.order(:name)
> render partial: 'countries_picker', layout: false
> end
>
> def states
> country = Country.find params[:id]
> @states = country.states.order(:name)
> render partial: 'states_picker', layout: false
> end
>
> def cities
> state = State.find params[:id]
> @cities = state.cities.order(:name)
> render partial: 'cities_picker', layout: false
> end
> end
>
> Your routes could look like this:
>
> match '/countries', to: 'pickers#countries', via: :get, as: :countries_picker
> match '/states', to: 'pickers#states', via: :get, as: :states_picker
> match '/cities', to: 'pickers#cities', via: :get, as: :cities_picker
>
> See -- there's no rules that say that you have to use one controller for one model, or have a separate controller for each model. Mix and match. Have fun! Rails is flexible.
>
> Walter
>
> > On May 30, 2019, at 6:56 PM, David Merrick <merrickdav@gmail.com> wrote:
> >
> > Hi If this is my last table I want to use
> >
> > create_table "points", force: :cascade do |t|
> > t.text "place"
> > t.text "riders"
> > t.integer "racepoints"
> > t.text "status"
> > t.integer "race_id"
> > t.datetime "created_at", null: false
> > t.datetime "updated_at", null: false
> > t.index ["race_id"], name: "index_points_on_race_id"
> > end
> >
> > Which references the other tables. Are you saying I could just use this table or do I still need the Pickers controller?
> >
> > Cheers Dave
> >
> > On Fri, May 31, 2019 at 1:23 AM Walter Lee Davis <waltd@wdstudio.com> wrote:
> > Yes, that's how you would get the pickers controller, if that's how you want to model this. You could also use your existing controller for the object in question (I've forgotten the names of things in your original app). If you had a widgets_controller, you could make a method in that for each of your pickers. Your route would change depending on which approach you chose. To add the route, you would open your routes file and add the appropriate declaration there:
> >
> > (assuming you were using pickers_controller#picker_two)
> >
> > resources :pickers, only: [] do
> > collection do
> > get :picker_two, to: 'pickers#picker_two'
> > get :picker_three, to: 'pickers#picker_three'
> > end
> > end
> >
> > (If you already had a widgets_controller, and wanted to add on)
> >
> > resources :widgets do
> > collection do
> > get :picker_two, to: 'widgets#picker_two'
> > get :picker_three, to: 'widgets#picker_three'
> > end
> > end
> >
> > Then run 'rake routes' to see what those routes get named. Note that because these are "collection" routes, they won't pass the ID as I had noted in my example previously. You'd have to pass that as a querystring variable, so your link would be something like /widgets/picker_two?parent=42, and you'd have to allow the parent argument in your safe_params, and then get it with params[:parent] rather than relying on the id.
> >
> > Most flexible of all would be to use match rather than a resource-based route:
> >
> > match 'picker_two/:id', to: 'pickers#picker_two', via: :get, as: :picker_two
> >
> > That would get you a very specific named route that would fit with my original example.
> >
> > All of this is covered in great detail in the excellent guide "Routing from the outside in", at guides.rubyonrails.org
> >
> > The ultimate answer to your questions is 'you use the framework'. All the tools are there for you to build whatever you want, or whatever makes sense to you.
> >
> > Walter
> >
> > > On May 30, 2019, at 12:15 AM, David Merrick <merrickdav@gmail.com> wrote:
> > >
> > > Hi Can I just do rails g controller Pickers?
> > >
> > > How do I get the route for this as not one is made?
> > >
> > > Cheers Dave
> > >
> > > On Wed, May 29, 2019 at 12:57 AM Walter Lee Davis <waltd@wdstudio.com> wrote:
> > > The way I start doing this is to decompose the view into partials, at least one per picker. Make sure that each partial after the first one takes an argument (allowed to be null) indicating what the previous picker chose. If there is no argument passed, the picker is rendered with no options. Next, you need to add controller, with a route per picker, and either write unobtrusive JS event listeners, or add long-hand onchange arguments to your picker to trigger the next picker.
> > >
> > > f.collection_select :picker_one, @picker_one_options, :name, :id
> > >
> > > $(document).on('change', '#picker_one', function(evt){
> > > $('#picker_two_holder').load('/pickers/picker_two/' + $(this).val());
> > > });
> > >
> > > In the pickers_controller, you'd have a method like
> > >
> > > def picker_two
> > > @picker_two_options = Option.find(params[:id]).children
> > > render partial: 'picker_two', layout: false
> > > end
> > >
> > > Each picker then loads the next one, and finally, the surrounding form is submitted with all the dynamic pickers within it.
> > >
> > > Let me know if any of this is too cryptic.
> > >
> > > Walter
> > >
> > > > On May 28, 2019, at 4:06 AM, David Merrick <merrickdav@gmail.com> wrote:
> > > >
> > > > My Schema.rb is below
> > > >
> > > > ActiveRecord::Schema.define(version: 2019_05_27_040649) do
> > > >
> > > > create_table "days", force: :cascade do |t|
> > > > t.integer "season_id"
> > > > t.datetime "created_at", null: false
> > > > t.datetime "updated_at", null: false
> > > > t.date "raceday"
> > > > t.index ["season_id"], name: "index_days_on_season_id"
> > > > end
> > > >
> > > > create_table "points", force: :cascade do |t|
> > > > t.text "place"
> > > > t.text "riders"
> > > > t.integer "racepoints"
> > > > t.text "status"
> > > > t.integer "race_id"
> > > > t.datetime "created_at", null: false
> > > > t.datetime "updated_at", null: false
> > > > t.index ["race_id"], name: "index_points_on_race_id"
> > > > end
> > > >
> > > > create_table "races", force: :cascade do |t|
> > > > t.boolean "display"
> > > > t.text "racename"
> > > > t.integer "season_id"
> > > > t.integer "day_id"
> > > > t.datetime "created_at", null: false
> > > > t.datetime "updated_at", null: false
> > > > t.text "raceclass"
> > > > t.index ["day_id"], name: "index_races_on_day_id"
> > > > t.index ["season_id"], name: "index_races_on_season_id"
> > > > end
> > > >
> > > > create_table "seasons", force: :cascade do |t|
> > > > t.date "year"
> > > > t.datetime "created_at", null: false
> > > > t.datetime "updated_at", null: false
> > > > end
> > > >
> > > > end
> > > >
> > > > I want to end up with something like this for the race index.html.erb file
> > > >
> > > >
> > > >
> > > > <MoorePark Results.png>
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > You select the season it then displays the days for the the selected season. You then select the day and the races for that day are displayed.
> > > >
> > > > The four tables are joined and the results is displayed in the Race Details.
> > > >
> > > > My current points index.html is this.
> > > >
> > > > <p id="notice"><%= notice %></p>
> > > >
> > > > <h1>Points</h1>
> > > >
> > > > <div class ='row'>
> > > > <div class="control-group">
> > > > <div class= 'pointsLabel'>Season</div>
> > > > <div class='controls'>
> > > > <%= collection_select(:season, :id, Season.all, :id, :year, {}, {:multiple => false}) %>
> > > > </div>
> > > > </div>
> > > > </div><br>
> > > >
> > > > <div class ='row'>
> > > > <div class="control-group">
> > > > <div class= 'pointsLabel'>Race Day</div>
> > > > <div class='controls'>
> > > > <%= collection_select(:day, :id, Day.all, :id, :raceday, {}, {:multiple => false}) %>
> > > > </div>
> > > > </div>
> > > > </div><br>
> > > >
> > > > <div class ='row'>
> > > > <div class="control-group">
> > > > <div class= 'pointsLabel'>Race Name</div>
> > > > <div class='controls'>
> > > > <%= collection_select(:race, :id, Race.all, :id, :racename, {}, {:multiple => false}) %>
> > > > </div>
> > > > </div>
> > > > </div><br>
> > > >
> > > > <br>
> > > >
> > > > I am thinking of using a grouped_collection_select to populate the relevant dropdowns . I know I need to Jquery or javascript to pass the selected options from one drop down to another .but can't get it to work
> > > >
> > > > Cheers Dave
> > > >
> > > > --
> > > > 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+unsubscribe@googlegroups.com.
> > > > To post to this group, send email to rubyonrails-talk@googlegroups.com.
> > > > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/39724b42-3377-44b4-8171-7635059f1f13%40googlegroups.com.
> > > > For more options, visit https://groups.google.com/d/optout.
> > > > <MoorePark Results.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+unsubscribe@googlegroups.com.
> > > To post to this group, send email to rubyonrails-talk@googlegroups.com.
> > > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/4426491F-C56F-4330-9EFE-6AB5C8B0189B%40wdstudio.com.
> > > For more options, visit https://groups.google.com/d/optout.
> > >
> > >
> > > --
> > > Dave Merrick
> > >
> > > TutorInvercargill
> > >
> > > http://tutorinvercargill.co.nz
> > >
> > > Daves Web Designs
> > >
> > > Website http://www.daveswebdesigns.co.nz
> > >
> > > Email merrickdav@gmail.com
> > >
> > > Ph 03 216 2053
> > >
> > > Cell 027 3089 169
> > >
> > > --
> > > 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+unsubscribe@googlegroups.com.
> > > To post to this group, send email to rubyonrails-talk@googlegroups.com.
> > > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CA%2B%3DMcKa1ZLg6rnE%3DE4VGP0LQ1wivHTS1aZPbHV91OKNZFiy8EQ%40mail.gmail.com.
> > > For more options, visit https://groups.google.com/d/optout.
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> > To post to this group, send email to rubyonrails-talk@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/F47B28D6-ECA9-4DF1-B3B4-573DB639D327%40wdstudio.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
> >
> > --
> > Dave Merrick
> >
> > TutorInvercargill
> >
> > http://tutorinvercargill.co.nz
> >
> > Daves Web Designs
> >
> > Website http://www.daveswebdesigns.co.nz
> >
> > Email merrickdav@gmail.com
> >
> > Ph 03 216 2053
> >
> > Cell 027 3089 169
> >
> > --
> > 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+unsubscribe@googlegroups.com.
> > To post to this group, send email to rubyonrails-talk@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CA%2B%3DMcKa2uFZFQHwLG_QKFfOxc%2B-BNXec%2Byw23d7U232172L%2BRg%40mail.gmail.com.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/271D9E11-3080-4377-8462-AA309CDD90BE%40wdstudio.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> Dave Merrick
>
> TutorInvercargill
>
> http://tutorinvercargill.co.nz
>
> Daves Web Designs
>
> Website http://www.daveswebdesigns.co.nz
>
> Email merrickdav@gmail.com
>
> Ph 03 216 2053
>
> Cell 027 3089 169
>
> --
> 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+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CA%2B%3DMcKbV2Kb61Y%2BDLpkvOkpSEBQJ-hroCyLeycQjHFKufHZH2g%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/05A69106-75C0-4153-BF31-CB3CEB124B2A%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails Tuesday, June 25, 2019

HI What would the  render partial: 'cities_picker', layout: false look like in your example?

On Fri, May 31, 2019 at 2:25 PM Walter Lee Davis <waltd@wdstudio.com> wrote:
What do the pickers mean? What values are they representing? When you choose one picker value, why does another picker need a different set of values to appear? If you can explain how you have modeled that part of your data, then I can help you further. In principle, a controller (any controller) can handle requests related to any model. It's just a convention that if you have a model Foo, you will have a FoosController to handle requests related to that model.

Here's a practical example of how you might use this sort of cascading picker:

class Country < ApplicationRecord
  has_many :states
end

class State < ApplicationRecord
  belongs_to :country
  has_many :cities
end

class City < ApplicationRecord
  belongs_to :state
end

You have a natural cascade of country to state to city, and it makes sense what those relationships are. The relationships are codified with the has_many and belongs_to macros, so it's clear that if you say @state.cities, you will get the cities that exist inside that state. You would do that by establishing what the parent id is in each child record. You might have Arizona as @state id = 1, and then have a bunch of cities like Phoenix: @city id = 22, state_id = 1, so you can gather them up.

So you have choices now as to choosing a controller pattern. The REST design says that you should have a separate controller for each model, and so that could go like this:

class CountriesController < ApplicationController
  def index
    @countries = Country.order(:name)
    render partial: 'countries_picker', layout: false
  end

  def show
    country = Country.find params[:id]
    @states = @country.states.order(:name)
    render partial: 'states_picker', layout: false
  end
end

class StatesController < ApplicationController
  def show
    state = State.find params[:id]
    @cities = @state.cities.order(:name)
    render partial: 'cities_picker', layout: false
  end
end

Your routes would look like this

resources :countries, only: [:index, :show]
resources :states, only: :show

If you wanted to have a single controller concerned with making these pickers (and ignore the whole REST thing), then you could have:

class PickersController < ApplicationController
  def countries
    @countries = Country.order(:name)
    render partial: 'countries_picker', layout: false
  end

  def states
    country = Country.find params[:id]
    @states = country.states.order(:name)
    render partial: 'states_picker', layout: false
  end

  def cities
    state = State.find params[:id]
    @cities = state.cities.order(:name)
    render partial: 'cities_picker', layout: false
  end
end

Your routes could look like this:

match '/countries', to: 'pickers#countries', via: :get, as: :countries_picker
match '/states', to: 'pickers#states', via: :get, as: :states_picker
match '/cities', to: 'pickers#cities', via: :get, as: :cities_picker

See -- there's no rules that say that you have to use one controller for one model, or have a separate controller for each model. Mix and match. Have fun! Rails is flexible.

Walter

> On May 30, 2019, at 6:56 PM, David Merrick <merrickdav@gmail.com> wrote:
>
> Hi If this is my last table I want to use
>
> create_table "points", force: :cascade do |t|
>     t.text "place"
>     t.text "riders"
>     t.integer "racepoints"
>     t.text "status"
>     t.integer "race_id"
>     t.datetime "created_at", null: false
>     t.datetime "updated_at", null: false
>     t.index ["race_id"], name: "index_points_on_race_id"
>   end
>
> Which references the other tables.  Are you saying I could just use this table or do I still need the Pickers controller?
>
> Cheers Dave
>
> On Fri, May 31, 2019 at 1:23 AM Walter Lee Davis <waltd@wdstudio.com> wrote:
> Yes, that's how you would get the pickers controller, if that's how you want to model this. You could also use your existing controller for the object in question (I've forgotten the names of things in your original app). If you had a widgets_controller, you could make a method in that for each of your pickers. Your route would change depending on which approach you chose. To add the route, you would open your routes file and add the appropriate declaration there:
>
> (assuming you were using pickers_controller#picker_two)
>
> resources :pickers, only: [] do
>   collection do
>     get :picker_two, to: 'pickers#picker_two'
>     get :picker_three, to: 'pickers#picker_three'
>   end
> end
>
> (If you already had a widgets_controller, and wanted to add on)
>
> resources :widgets do
>   collection do
>     get :picker_two, to: 'widgets#picker_two'
>     get :picker_three, to: 'widgets#picker_three'
>   end
> end
>
> Then run 'rake routes' to see what those routes get named. Note that because these are "collection" routes, they won't pass the ID as I had noted in my example previously. You'd have to pass that as a querystring variable, so your link would be something like /widgets/picker_two?parent=42, and you'd have to allow the parent argument in your safe_params, and then get it with params[:parent] rather than relying on the id.
>
> Most flexible of all would be to use match rather than a resource-based route:
>
> match 'picker_two/:id', to: 'pickers#picker_two', via: :get, as: :picker_two
>
> That would get you a very specific named route that would fit with my original example.
>
> All of this is covered in great detail in the excellent guide "Routing from the outside in", at guides.rubyonrails.org
>
> The ultimate answer to your questions is 'you use the framework'. All the tools are there for you to build whatever you want, or whatever makes sense to you.
>
> Walter
>
> > On May 30, 2019, at 12:15 AM, David Merrick <merrickdav@gmail.com> wrote:
> >
> > Hi Can I just do rails g controller Pickers?
> >
> > How do I get the route for this as not one is made?
> >
> > Cheers Dave
> >
> > On Wed, May 29, 2019 at 12:57 AM Walter Lee Davis <waltd@wdstudio.com> wrote:
> > The way I start doing this is to decompose the view into partials, at least one per picker. Make sure that each partial after the first one takes an argument (allowed to be null) indicating what the previous picker chose. If there is no argument passed, the picker is rendered with no options. Next, you need to add controller, with a route per picker, and either write unobtrusive JS event listeners, or add long-hand onchange arguments to your picker to trigger the next picker.
> >
> > f.collection_select :picker_one, @picker_one_options, :name, :id
> >
> > $(document).on('change', '#picker_one', function(evt){
> >   $('#picker_two_holder').load('/pickers/picker_two/' + $(this).val());
> > });
> >
> > In the pickers_controller, you'd have a method like
> >
> > def picker_two
> >   @picker_two_options = Option.find(params[:id]).children
> >   render partial: 'picker_two', layout: false
> > end
> >
> > Each picker then loads the next one, and finally, the surrounding form is submitted with all the dynamic pickers within it.
> >
> > Let me know if any of this is too cryptic.
> >
> > Walter
> >
> > > On May 28, 2019, at 4:06 AM, David Merrick <merrickdav@gmail.com> wrote:
> > >
> > > My Schema.rb is below
> > >
> > > ActiveRecord::Schema.define(version: 2019_05_27_040649) do
> > >
> > >   create_table "days", force: :cascade do |t|
> > >     t.integer "season_id"
> > >     t.datetime "created_at", null: false
> > >     t.datetime "updated_at", null: false
> > >     t.date "raceday"
> > >     t.index ["season_id"], name: "index_days_on_season_id"
> > >   end
> > >
> > >   create_table "points", force: :cascade do |t|
> > >     t.text "place"
> > >     t.text "riders"
> > >     t.integer "racepoints"
> > >     t.text "status"
> > >     t.integer "race_id"
> > >     t.datetime "created_at", null: false
> > >     t.datetime "updated_at", null: false
> > >     t.index ["race_id"], name: "index_points_on_race_id"
> > >   end
> > >
> > >   create_table "races", force: :cascade do |t|
> > >     t.boolean "display"
> > >     t.text "racename"
> > >     t.integer "season_id"
> > >     t.integer "day_id"
> > >     t.datetime "created_at", null: false
> > >     t.datetime "updated_at", null: false
> > >     t.text "raceclass"
> > >     t.index ["day_id"], name: "index_races_on_day_id"
> > >     t.index ["season_id"], name: "index_races_on_season_id"
> > >   end
> > >
> > >   create_table "seasons", force: :cascade do |t|
> > >     t.date "year"
> > >     t.datetime "created_at", null: false
> > >     t.datetime "updated_at", null: false
> > >   end
> > >
> > > end
> > >
> > > I want to end up with something like this for the race index.html.erb file
> > >
> > >
> > >
> > > <MoorePark Results.png>
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > You select the season it then displays the days for the the selected season. You then select the day and the races for that day are displayed.
> > >
> > > The four tables are joined and the results is displayed in the Race Details.
> > >
> > > My current points index.html is this.
> > >
> > > <p id="notice"><%= notice %></p>
> > >
> > > <h1>Points</h1>
> > >
> > >   <div class ='row'>
> > >     <div class="control-group">
> > >       <div class= 'pointsLabel'>Season</div>
> > >       <div class='controls'>
> > >         <%= collection_select(:season, :id, Season.all, :id, :year, {}, {:multiple => false}) %>
> > >       </div>
> > >     </div>
> > >   </div><br>
> > >
> > >   <div class ='row'>
> > >     <div class="control-group">
> > >       <div class= 'pointsLabel'>Race Day</div>
> > >       <div class='controls'>
> > >         <%= collection_select(:day, :id, Day.all, :id, :raceday, {}, {:multiple => false}) %>
> > >       </div>
> > >     </div>
> > >   </div><br>
> > >
> > >   <div class ='row'>
> > >     <div class="control-group">
> > >       <div class= 'pointsLabel'>Race Name</div>
> > >       <div class='controls'>
> > >         <%= collection_select(:race, :id, Race.all, :id, :racename, {}, {:multiple => false}) %>
> > >       </div>
> > >     </div>
> > >   </div><br>
> > >
> > > <br>
> > >
> > > I am thinking of using a grouped_collection_select to populate the relevant dropdowns . I know I need to Jquery or javascript to pass the selected options from one drop down to another .but can't get it to work
> > >
> > > Cheers Dave
> > >
> > > --
> > > 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+unsubscribe@googlegroups.com.
> > > To post to this group, send email to rubyonrails-talk@googlegroups.com.
> > > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/39724b42-3377-44b4-8171-7635059f1f13%40googlegroups.com.
> > > For more options, visit https://groups.google.com/d/optout.
> > > <MoorePark Results.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+unsubscribe@googlegroups.com.
> > To post to this group, send email to rubyonrails-talk@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/4426491F-C56F-4330-9EFE-6AB5C8B0189B%40wdstudio.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
> >
> > --
> > Dave Merrick
> >
> > TutorInvercargill
> >
> > http://tutorinvercargill.co.nz
> >
> > Daves Web Designs
> >
> > Website http://www.daveswebdesigns.co.nz
> >
> > Email merrickdav@gmail.com
> >
> > Ph   03 216 2053
> >
> > Cell 027 3089 169
> >
> > --
> > 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+unsubscribe@googlegroups.com.
> > To post to this group, send email to rubyonrails-talk@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CA%2B%3DMcKa1ZLg6rnE%3DE4VGP0LQ1wivHTS1aZPbHV91OKNZFiy8EQ%40mail.gmail.com.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/F47B28D6-ECA9-4DF1-B3B4-573DB639D327%40wdstudio.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> Dave Merrick
>
> TutorInvercargill
>
> http://tutorinvercargill.co.nz
>
> Daves Web Designs
>
> Website http://www.daveswebdesigns.co.nz
>
> Email merrickdav@gmail.com
>
> Ph   03 216 2053
>
> Cell 027 3089 169
>
> --
> 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+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CA%2B%3DMcKa2uFZFQHwLG_QKFfOxc%2B-BNXec%2Byw23d7U232172L%2BRg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

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


--
Dave Merrick

TutorInvercargill


Email merrickdav@gmail.com

Ph   03 216 2053

Cell 027 3089 169

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CA%2B%3DMcKbV2Kb61Y%2BDLpkvOkpSEBQJ-hroCyLeycQjHFKufHZH2g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails Sunday, June 23, 2019

> On Jun 23, 2019, at 10:32 PM, David Merrick <merrickdav@gmail.com> wrote:
>
> Schema
>
> create_table "days", force: :cascade do |t|
> t.integer "season_id"
> t.datetime "created_at", null: false
> t.datetime "updated_at", null: false
> t.date "raceday"
> t.index ["season_id"], name: "index_days_on_season_id"
> end
>
> create_table "seasons", force: :cascade do |t|
> t.date "year"
> t.datetime "created_at", null: false
> t.datetime "updated_at", null: false
> end
>
> @seasonmax = Season.last.id gives me me 7 the last id in the Seasons Table
>
> @days = Day.find_by_sql("SELECT DISTINCT days.id,raceday FROM days INNER JOIN seasons on seasons.id WHERE days.season_id = @season_id") gives me an an empty list
>
> @days = Day.find_by_sql("SELECT DISTINCT days.id,raceday FROM days INNER JOIN seasons on seasons.id WHERE days.season_id = 7") gives me the list I want
>
> [#<Day id: 39, raceday: "2018-10-21">, #<Day id: 40, raceday: "2018-11-16">, #<Day id: 41, raceday: "2018-12-01">, #<Day id: 42, raceday: "2019-01-12">, #<Day id: 43, raceday: "2019-02-16">, #<Day id: 44, raceday: "2019-03-02">, #<Day id: 45, raceday: "2019-03-31">, #<Day id: 46, raceday: "2019-04-20">]
>
> Why is the @seasonmax variable not picked in the SQL Query
>
> @days = Day.find_by_sql("SELECT DISTINCT days.id,raceday FROM days INNER JOIN seasons on seasons.id WHERE days.season_id = @season_id")


Looks like a few things wrong with the techniques here, but the jist is that @season_id in SQL means nothing meaningful to the SQL backend. Perhaps something like:

@days = Day.find_by_sql("SELECT DISTINCT days.id,raceday FROM days INNER JOIN seasons on seasons.id WHERE days.season_id = "+(@season_id.to_s))

But, this seems rather odd and can open up some issues with over complicating the code and possible SQL injection, etc.

Hope this helps.


Phil

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3D5684BB-6CB0-4161-8DC6-03369EEFBCC0%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Schema

create_table "days", force: :cascade do |t|
    t.integer "season_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.date "raceday"
    t.index ["season_id"], name: "index_days_on_season_id"
  end

create_table "seasons", force: :cascade do |t|
    t.date "year"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

@seasonmax = Season.last.id gives me me 7 the last id in the Seasons Table

@days = Day.find_by_sql("SELECT DISTINCT days.id,raceday FROM days INNER JOIN seasons on seasons.id WHERE days.season_id = @season_id") gives me an an empty list

@days = Day.find_by_sql("SELECT DISTINCT days.id,raceday FROM days INNER JOIN seasons on seasons.id WHERE days.season_id = 7") gives me the list I want

[#<Day id: 39, raceday: "2018-10-21">, #<Day id: 40, raceday: "2018-11-16">, #<Day id: 41, raceday: "2018-12-01">, #<Day id: 42, raceday: "2019-01-12">, #<Day id: 43, raceday: "2019-02-16">, #<Day id: 44, raceday: "2019-03-02">, #<Day id: 45, raceday: "2019-03-31">, #<Day id: 46, raceday: "2019-04-20">] 

 Why is the @seasonmax  variable not picked in the SQL  Query

@days = Day.find_by_sql("SELECT DISTINCT days.id,raceday FROM days INNER JOIN seasons on seasons.id WHERE days.season_id = @season_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+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d83efdba-feb9-4da2-b56e-f30a8009d2a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails Friday, June 14, 2019

In the mean time you can add a rake task to the lib folder to rename credentials, or a bash/Ruby script to the bin folder:

Given: development.yml.enc, test.yml.enc, production.yml.enc

lib/tasks/credentials.rake

namespace : credentials do
  namespace :set_env do
    task production: : environment do
      Rake::Task['credentials:set_env'].invoke('production')
    end

    task test: : environment do
      Rake::Task['credentials:set_env'].invoke('test')
    end

    task development: : environment do
      Rake::Task['credentials:set_env'].invoke('development')
    end
  end

  task :set_env, [ :env_name ] => : environment do |_, args|
    File.open(Rails.root.join('config', 'credentials.yml.enc'), 'w') do |f|
      f.write(File.read(Rails.root.join('config', "#{args[:env_name]}.ym.enc")))
    end
  end
end

For something dynamic you could do

namespace : credentials do
  namespace :set_env do
    Dir['config/*.yml.enc'].each do |path|
      f_name = path[/(\w+)\.yml\.enc$/, 1].to_sym
      next if f_name == :credentials

      task f_name => : environment do
        File.open(Rails.root.join('config', 'credentials.yml.enc'), 'w') do |f|
          f.write(File.read(path))
        end
     end
  end
end


On Wed, Jun 12, 2019, 07:09 tech@datatravels.com <tech@datatravels.com> wrote:
I think this solution seems the most Rails 5.2 friendly, but ideally isn't the perfect solution as ideally you could in fact (one day, in Rails 6, say), separate the 3 files themselves, so you could, say, give junior developers access to only development+staging credentials by giving the only the keys for the development + staging master keys (but continuing to check-in all 3 .yml.enc files into source-code. the 3 keys are of course, not checked-in)

But if you have a team where you don't care if all the devs have the same (full) credentials then I like this solution best.

-Jason





On Jun 10, 2019, at 8:40 PM, Sampson Crowley <sampsonsprojects@gmail.com> wrote:

for rails 5, just nest environment specific credentials under a key for said environment

then all you have to do when accessing said config is add the environment to the party that pulls in config, e.g.:

credentials.yml.enc:

main_key:
  development
:
    sub_key
:
      value_key
: 'development'
  production
:
    sub_key
:
      value_key
: 'production'
  test
:
    sub_key
:
      value_key
: 'test'

code:


my_credential
= Rails.application.credentials.dig(:main_key, Rails.env.to_sym, :sub_key, :value_key)
```

On Sunday, June 9, 2019 at 7:40:05 PM UTC-6, Jason Fleetwood-Boldt wrote:
In some apps I've worked on Rails 5.1 and prior, environment variables, saved directly into the source code.

In rails 5.2 Custom credentials encourages us to check-in only the encrypted version of our configuration, and keep our master.key keyfile outside of our repository. 

My question is this: Is there a way to segregate by environment? (i.e., development, staging, production?)

seems like the instructions for setting up AWS keys, for example, would have the dev, staging + production all pointing to & using the same AWS bucket, access key, and secret. But it seems like for many services I'd want to have different credentials for different environments. 

I found this SO post that discusses this question, but unfortunately it doesn't present a very good answer IMHO because the there are only two answers: 1) I don't quite understand and 2) a suggestion to basically check all your ENV variables against each of your environments, which seems like it could encourage a messy setup. I much like answer #1 from this SO post, but I don't understand how to implement it practically. 


any tip appreciated. 
Thanks,
Jason

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/01fa12ca-06f5-4246-bead-503af4bf1a5c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/C2DFCFDD-69CD-4A7C-A7C3-1898210E9B42%40datatravels.com.
For more options, visit https://groups.google.com/d/optout.

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

Ruby on Rails Thursday, June 13, 2019

Thx Sampson - as it turned out it was SELinux and extended file attributes playing me :/


Added an update and how to to the repo and the thread in this group

Thx,
Walther

Den 13. jun. 2019 kl. 20.30 skrev Sampson Crowley <sampsonsprojects@gmail.com>:

*put it in both blocks

On Thu, Jun 13, 2019 at 12:28 PM Sampson Crowley <sampsonsprojects@gmail.com> wrote:
https://stackoverflow.com/a/35794955/9196467

you only have max body size set on https, but it in both blocks. also where is you main http block config? you can set the max body size there as well

On Thu, Jun 13, 2019 at 10:45 AM Walther Privat <walther@diechmann.net> wrote:
Hi Sampson Crowley,

Good of you to answer :)

Entire project on github and nginx confit in config/sucker.nginx.conf (gets linked on deploys)

Med venlig hilsen
Walther

Den 13. jun. 2019 kl. 17.51 skrev Sampson Crowley <sampsonsprojects@gmail.com>:

Have you tested your app in production mode without Nginx in front of it?

On Thu, Jun 13, 2019, 09:46 Sampson Crowley <sampsonsprojects@gmail.com> wrote:
Can't help without your Nginx config. Nginx is just a reverse proxy. There's nothing you can do in rails that you can't do with Nginx in front of it. There's a problem with how you have Nginx set up, not with rails

On Thu, Jun 13, 2019, 02:25 Walther Diechmann <walther@diechmann.net> wrote:
I've added this issue on rails/rails https://github.com/rails/rails/issues/36464 but was redirected here - fair enough (as I was not able to point to any malfunc)

Does anyone know of issues with NGINX in front of PUMA serving ActionCable and ActiveStorage?

My experience is that either I can have ActiveStorage working perfectly or I can have ActiveStorage working perfectly?!?

I have the code in this repo: https://github.com/wdiechmann/sucker.git and a demo here: https://sucker.alco.dk/messages

-- 
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+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ab5964f5-1e40-495c-8399-a7d1c72c0be7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

-- 
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/5C04D328-906E-4ADF-8598-020F0328416A%40diechmann.net.
For more options, visit https://groups.google.com/d/optout.

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