Ruby on Rails Monday, February 29, 2016

Hi

On Tue, Mar 1, 2016, at 07:44, fugee ohu wrote:
> In my view:
>
> <a href= "<%= task.name %>" data-description = "<%= task.comment %>"
> data-gallery ><%= image_tag(task.name.thumb) %></a>
>

I don't know if it's typo in your mail or you just don't notice but
this:

<a href= "<%= task.name %>" data-description = "<%= task.comment %>"
data-gallery >

will have an empty data-description attribute because there are spaces
between the equal sign so they just become another attributes
(data-description = "content" -> three different attributes, two of
which are invalid).

Correct one is:

<a href="<%= task.name %>" data-description="<%= task.comment %>"
data-gallery>

--
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/1456807736.1306344.535808354.2F22A50A%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Thank you, Thank you, Thank you!, removing the nil? actually worked.
Question How friendly is rails with videos, I also want to upload
videos. but can't seem to find any tutorials on doing that.

--
Posted via http://www.ruby-forum.com/.

--
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/d354ce660f586a1e23a9f50caa6db9d9%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails



On Monday, February 29, 2016 at 9:22:55 PM UTC-5, Walter Lee Davis wrote:

> On Feb 29, 2016, at 8:39 PM, fugee ohu <fuge...@gmail.com> wrote:
>
>
>
> On Monday, February 29, 2016 at 9:39:28 AM UTC-5, Walter Lee Davis wrote:
>
> > On Feb 28, 2016, at 7:24 PM, fugee ohu <fuge...@gmail.com> wrote:
> >
> >
> >
> [snip]
>
> > >  Here's the code they provide, I tried but it doesn't have any effect so far
> > >
> > >  blueimp.Gallery(
> > >     document.getElementById('links'),
> > >     {
> > >         onslide: function (index, slide) {
> > >             var text = this.list[index].getAttribute('data-description'),
> >
> > For the preceding line to work, your element needs to have the attribute data-description on it. Does it?
> >
> > >                 node = this.container.find('.description');
> >
> > For the preceding line to work, you need to have an empty HTML element with the classname description present in the page, within the container element of the slide (no clue where that means, I'm just interpreting the code for you). If that element exists, then it will be emptied and re-filled with the description.
> >
> > >             node.empty();
> > >             if (text) {
> > >                 node[0].appendChild(document.createTextNode(text));
> > >             }
> > >         }
> > >     }
> > > );
> >
> > My guess is that you are missing one or more of these antecedents, and without them, the JS won't have anything to work with.
> >
> > Walter
> >
> >
> > hi, thanks, i dunno what you mean by an empty html element with the classname description, i think you mean <div class="description"> but that's not my view Here's my view:
> >  
> > <div id="links">
> >  <table>
> >  <% @profile.pictures.in_groups_of(5, false) do |row_tasks| %>
> >   <tr>
> >    <% for task in row_tasks do %>
> >     <td><a href= "<%= task.name %>" data-description = "<%= task.comment %>" data-gallery ><%= image_tag(task.name.thumb) %></a></td>
> >    <% end %>
> >   <% end %>
> >   </tr>
> >  </table>
> > </div>
>
> Yes, you did get what I meant. Reading through the portion of the script you provided, I can't see where that element needs to be. Perhaps it is added by the lightbox code when it creates the overlay elements. In any case, you have added the correct data attributes to the link, so that part looks right. In the example for the gallery, was there any reference to creating a separate structure in the page html to receive the description? In the documentation, do they have an example page coded in HTML that includes a secondary overlay element or similar? Or is it all generated by the JS code when the page loads?
>
> 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-ta...@googlegroups.com.
> > To post to this group, send email to rubyonra...@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ed810211-4222-4a87-978f-bf9942b78193%40googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
>
> No, there isn't The docs are at https://github.com/blueimp/Gallery/blob/master/README.md#setup and the relevant section is headed Additional Gallery Elements about 3/4 of the way down ~ fugue

Start here, and see that you do need to add a description element (empty) if you want it to be updated with the value you set in the data-description attribute.

https://github.com/blueimp/Gallery/blob/master/README.md#additional-gallery-elements

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-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ba8a9e19-aead-47d7-b7d1-0e516a6db7dc%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


OK Sorry Actually I have it in my view already The author calls it the widget here it is from my view:

<div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls">
    <!-- The container for the modal slides -->
    <div class="slides"></div>
    <!-- Controls for the borderless lightbox -->
    <h3 class="title"></h3>
    <p class="description"></p>
    <a class="prev">‹</a>
    <a class="next">›</a>
    <a class="close">×</a>
    <a class="play-pause"></a>
    <ol class="indicator"></ol>
    </div>

--
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/8867153e-ef42-4cff-afd5-18249a1d0d46%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

> On Feb 29, 2016, at 8:39 PM, fugee ohu <fugee279@gmail.com> wrote:
>
>
>
> On Monday, February 29, 2016 at 9:39:28 AM UTC-5, Walter Lee Davis wrote:
>
> > On Feb 28, 2016, at 7:24 PM, fugee ohu <fuge...@gmail.com> wrote:
> >
> >
> >
> [snip]
>
> > > Here's the code they provide, I tried but it doesn't have any effect so far
> > >
> > > blueimp.Gallery(
> > > document.getElementById('links'),
> > > {
> > > onslide: function (index, slide) {
> > > var text = this.list[index].getAttribute('data-description'),
> >
> > For the preceding line to work, your element needs to have the attribute data-description on it. Does it?
> >
> > > node = this.container.find('.description');
> >
> > For the preceding line to work, you need to have an empty HTML element with the classname description present in the page, within the container element of the slide (no clue where that means, I'm just interpreting the code for you). If that element exists, then it will be emptied and re-filled with the description.
> >
> > > node.empty();
> > > if (text) {
> > > node[0].appendChild(document.createTextNode(text));
> > > }
> > > }
> > > }
> > > );
> >
> > My guess is that you are missing one or more of these antecedents, and without them, the JS won't have anything to work with.
> >
> > Walter
> >
> >
> > hi, thanks, i dunno what you mean by an empty html element with the classname description, i think you mean <div class="description"> but that's not my view Here's my view:
> >
> > <div id="links">
> > <table>
> > <% @profile.pictures.in_groups_of(5, false) do |row_tasks| %>
> > <tr>
> > <% for task in row_tasks do %>
> > <td><a href= "<%= task.name %>" data-description = "<%= task.comment %>" data-gallery ><%= image_tag(task.name.thumb) %></a></td>
> > <% end %>
> > <% end %>
> > </tr>
> > </table>
> > </div>
>
> Yes, you did get what I meant. Reading through the portion of the script you provided, I can't see where that element needs to be. Perhaps it is added by the lightbox code when it creates the overlay elements. In any case, you have added the correct data attributes to the link, so that part looks right. In the example for the gallery, was there any reference to creating a separate structure in the page html to receive the description? In the documentation, do they have an example page coded in HTML that includes a secondary overlay element or similar? Or is it all generated by the JS code when the page loads?
>
> 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-ta...@googlegroups.com.
> > To post to this group, send email to rubyonra...@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ed810211-4222-4a87-978f-bf9942b78193%40googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
>
> No, there isn't The docs are at https://github.com/blueimp/Gallery/blob/master/README.md#setup and the relevant section is headed Additional Gallery Elements about 3/4 of the way down ~ fugue

Start here, and see that you do need to add a description element (empty) if you want it to be updated with the value you set in the data-description attribute.

https://github.com/blueimp/Gallery/blob/master/README.md#additional-gallery-elements

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+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/ba8a9e19-aead-47d7-b7d1-0e516a6db7dc%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/9FF8A63C-4170-4D75-A9EA-70645A73A68D%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails



On Monday, February 29, 2016 at 9:39:28 AM UTC-5, Walter Lee Davis wrote:

> On Feb 28, 2016, at 7:24 PM, fugee ohu <fuge...@gmail.com> wrote:
>
>
>
[snip]

> >  Here's the code they provide, I tried but it doesn't have any effect so far
> >
> >  blueimp.Gallery(
> >     document.getElementById('links'),
> >     {
> >         onslide: function (index, slide) {
> >             var text = this.list[index].getAttribute('data-description'),
>
> For the preceding line to work, your element needs to have the attribute data-description on it. Does it?
>
> >                 node = this.container.find('.description');
>
> For the preceding line to work, you need to have an empty HTML element with the classname description present in the page, within the container element of the slide (no clue where that means, I'm just interpreting the code for you). If that element exists, then it will be emptied and re-filled with the description.
>
> >             node.empty();
> >             if (text) {
> >                 node[0].appendChild(document.createTextNode(text));
> >             }
> >         }
> >     }
> > );
>
> My guess is that you are missing one or more of these antecedents, and without them, the JS won't have anything to work with.
>
> Walter
>
>
> hi, thanks, i dunno what you mean by an empty html element with the classname description, i think you mean <div class="description"> but that's not my view Here's my view:
>  
> <div id="links">
>  <table>
>  <% @profile.pictures.in_groups_of(5, false) do |row_tasks| %>
>   <tr>
>    <% for task in row_tasks do %>
>     <td><a href= "<%= task.name %>" data-description = "<%= task.comment %>" data-gallery ><%= image_tag(task.name.thumb) %></a></td>
>    <% end %>
>   <% end %>
>   </tr>
>  </table>
> </div>

Yes, you did get what I meant. Reading through the portion of the script you provided, I can't see where that element needs to be. Perhaps it is added by the lightbox code when it creates the overlay elements. In any case, you have added the correct data attributes to the link, so that part looks right. In the example for the gallery, was there any reference to creating a separate structure in the page html to receive the description? In the documentation, do they have an example page coded in HTML that includes a secondary overlay element or similar? Or is it all generated by the JS code when the page loads?

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-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ed810211-4222-4a87-978f-bf9942b78193%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


No, there isn't The docs are at https://github.com/blueimp/Gallery/blob/master/README.md#setup and the relevant section is headed Additional Gallery Elements about 3/4 of the way down ~ fugee

--
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/ba8a9e19-aead-47d7-b7d1-0e516a6db7dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

I'd certainly prefer not to, but it is prescribed by the ARK standard:  https://en.wikipedia.org/wiki/Archival_Resource_Key

-Justin

On Mon, Feb 29, 2016 at 5:45 PM, Hassan Schroeder <hassan.schroeder@gmail.com> wrote:
On Mon, Feb 29, 2016 at 3:04 PM, digger250 <digger250@gmail.com> wrote:
> I'm trying to figure out how to escape a literal colon in the routes. If I
> make a route like this:
>
> get '/thing:/:id' => 'things#show'
>
> then '/thing:/123' does not match on this route
>
> I've also tried '/thing\:/:id' and '/thing%3A/:id' none seem to work.
>
> Does anyone have any tips here?

Yes - don't do that  :-)

See https://www.ietf.org/rfc/rfc1738.txt, specifically Section 2.2 on
reserved characters.

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
Consulting Availability : Silicon Valley or remote

--
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/CACmC4yDceABV646sh%2BH5L4uWoW%3D1Scc2ucj6ta4tYLU_q8JmRg%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/CAGnAKfOwkVaD9BMUc3Q8At2ATKLEzPprmOUxW4yHCaTyRhr-hA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

On Mon, Feb 29, 2016 at 3:04 PM, digger250 <digger250@gmail.com> wrote:
> I'm trying to figure out how to escape a literal colon in the routes. If I
> make a route like this:
>
> get '/thing:/:id' => 'things#show'
>
> then '/thing:/123' does not match on this route
>
> I've also tried '/thing\:/:id' and '/thing%3A/:id' none seem to work.
>
> Does anyone have any tips here?

Yes - don't do that :-)

See https://www.ietf.org/rfc/rfc1738.txt, specifically Section 2.2 on
reserved characters.

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
Consulting Availability : Silicon Valley or remote

--
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/CACmC4yDceABV646sh%2BH5L4uWoW%3D1Scc2ucj6ta4tYLU_q8JmRg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

I'm trying to figure out how to escape a literal colon in the routes. If I make a route like this:

get '/thing:/:id' => 'things#show'

then '/thing:/123' does not match on this route

I've also tried '/thing\:/:id' and '/thing%3A/:id' none seem to work.

Does anyone have any tips here?

-Justin

--
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/091fa1a1-99e8-431c-b5c6-a17a1dbdca44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

In my view:

<a href= "<%= task.name %>" data-description = "<%= task.comment %>"  data-gallery ><%= image_tag(task.name.thumb) %></a>

In my js file:

blueimp.Gallery(
    document.getElementById('links'), {
        onslide: function (index, slide) {
            var text = this.list[index].getAttribute('data-description'),
                node = this.container.find('.description');
            node.empty();
            if (text) {
                node[0].appendChild(document.createTextNode(text));
            }
        }
});

document.getElementById('links').onclick = function (event) {
    event = event || window.event;
    var target = event.target || event.srcElement,
        link = target.src ? target.parentNode : target,
        options = {index: link, event: event, onslide: function (index, slide) {
            var text = this.list[index].getAttribute('data-description'),
                node = this.container.find('.description');
            node.empty();
            if (text) {
                node[0].appendChild(document.createTextNode(text));
            }
        } },
        links = this.getElementsByTagName('a');
    blueimp.Gallery(links, options);
};

--
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/c5b810d0-a0dd-4078-82ad-480021619b84%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails



On Monday, February 29, 2016 at 8:44:22 AM UTC-5, Colin Law wrote:
On 29 February 2016 at 13:25, fugee ohu <fuge...@gmail.com> wrote:
>
>
> On Monday, February 29, 2016 at 6:44:21 AM UTC-5, Colin Law wrote:
>>
>> On 29 February 2016 at 09:39, fugee ohu <fuge...@gmail.com> wrote:
>> > Using require statements in application.js should reference files
>> > located
>> > where?
>> > //= require bootstrap-sprockets
>> > where is bootstrap-sprockets supposed to be located?
>>
>> If you have included the appropriate gem in Gemfile then you don't
>> need to put it anywhere.
>>
>> Colin
>>
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Ruby on Rails: Talk" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to rubyonrails-ta...@googlegroups.com.
>> > To post to this group, send email to rubyonra...@googlegroups.com.
>> > To view this discussion on the web visit
>> >
>> > https://groups.google.com/d/msgid/rubyonrails-talk/e765dfe2-3dad-459e-adfc-92da95a65d80%40googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>
>
> Thanks, Colin So then why require them if they're all "gemmed out"? I'm
> having trouble getting data-description to work in bluimp-image-gallery If
> you read the docs it can be found  under Additional Gallery Elements The
> docs say to include links to javascript scripts at the bottom of my view
> using <script src= ... So that's what I did Seemed the javascript in
> question wasn't working so when I asked for help someone asked me if I was
> using the asset pipeline and then if i'm using the asset pipeline why am i
> putting the links to javascript scripts <script src= ... in my views and the
> discussion ended up concluding just about there after trying to get
> clarification Here's a gist of the files involved
> https://gist.github.com/mices/f9516cb3ea9da3f3c690 ~ thanks, fugee

Not sure what you mean by gemmed out.
I believe that you should either require it in application.js (in
which case it will be compiled in with the other js files) or
specifically include it in the page using the script tag.  The former
is generally preferred as it means the browser should only load the js
once for the whole website.  I have not used this particular library
though so don't know whether there is a reason why it should be
explicitly loaded in the page.

Google found this which may be helpful
http://stackoverflow.com/questions/21519040/rails-4-bootstrap-set-up-assets

Colin

Bootstrap's working, image gallery's working So, this is not the problem anyway The problem is i can't get the contents of data-description to display with the full image in the lightbox, which as it happens is the job of one js file I was thrown a curve with this question that was posed to me about the asset pipeline, but i'm very glad that you clarified that for me Also, if I add controls to the gallery widget, then the title displays in the full image lightbox view, as long as I pass a value to title in my view I've tried using static content for the data-description but that didn't make any difference ~ thanks, fugee

--
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/3b5691dd-6e57-4b13-87f2-238fe3144203%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

This is actually a series of 3 articles explaining how to get the best load time for an SPA and why Sprockets will not allow you to get the last required bits. More specifically, it doesn't support code splitting (lazy code loading) out of the box and it's not easy to implement that. But webpack does:

http://rosenfeld.herokuapp.com/en/articles/2016-02-26-improving-spa-loading-time-with-webpack-and-why-sprockets-is-in-your-way

--
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/88b2b4f7-8cb8-4d66-acf9-8657542d5150%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

up

--
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/c0858086-d94e-466a-9e0f-c59c5d437615%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

I'm using a Rails application to access a database from a legacy application. This application stores all datetime fields using Europe/Madrid timezone.

From what I've seem, it's only possible to set config.active_record.default_timezone to :utc (default) or :local which uses the OS timezone.

Since I cannot guarantee that my OS timezone will always be Europe/Madrid, I would like to set a specific timezone for active record.

Is there another of doing this?

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+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/3bb0ae0c-b5cd-45b7-9a9a-3d17ceadcf77%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

> On Feb 28, 2016, at 10:18 PM, Le Hung <lists@ruby-forum.com> wrote:
>
> I'm new in Rails.
>
> I'm trying to add a form with ajax.It's just typing a text and submit to
> file 'ex/act' and show the param in form.
>
> My code:
>
> <script>
> function loadDoc(url, cfunc) {
> var xhttp;
> xhttp=new XMLHttpRequest();
> xhttp.onreadystatechange = function() {
> if (xhttp.readyState == 4 && xhttp.status == 200) {
> cfunc(xhttp);
> }
> };
> xhttp.open("POST", url, true);
> xhttp.send();
> }
> function myFunction(xhttp) {
> document.getElementById("demo").innerHTML = xhttp.responseText;
> }
> </script>
>
> And the form:
>
> <%= form_for :ex,url:ex_act_path,remote:true do |f|%>
> <%= f.text_field :text%>
> <button onclick="loadDoc('ex/act',myFunction)">abc</button>
> <%end%>
>
> In the 'ex/act' controller:
>
> def act
> @a = get_param
> end
> private
> def get_param
> params.require(:ex).permit(:text)
> end
>
> In the Console of browser:
>
> POST http://localhost:3000/ex/act 422 Unprocessable Entity
> GET http://localhost:3000/ex/act 200 OK

Rails has full support for Ajax form submission baked in. Have you tried just adding remote: true to your form_for declaration, and see what happens? Watch in the console as you submit the form, see how the correct controller handles the request. If you write a JS view (name it the same as the controller method that is invoked by your form, so create.js.erb or update.js.erb, whichever is appropriate) then you will have access to your updated model object, and you can use it to re-paint the page with updated data. Here's a very nice write-up on this approach: http://www.korenlc.com/remote-true-in-rails-forms/

Walter

>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> 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/befb8748915a530c9f2e920b494f844c%40ruby-forum.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/3B618ED8-0DB9-4461-B03E-F3EF70AED383%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

> On Feb 28, 2016, at 7:24 PM, fugee ohu <fugee279@gmail.com> wrote:
>
>
>
[snip]

> > Here's the code they provide, I tried but it doesn't have any effect so far
> >
> > blueimp.Gallery(
> > document.getElementById('links'),
> > {
> > onslide: function (index, slide) {
> > var text = this.list[index].getAttribute('data-description'),
>
> For the preceding line to work, your element needs to have the attribute data-description on it. Does it?
>
> > node = this.container.find('.description');
>
> For the preceding line to work, you need to have an empty HTML element with the classname description present in the page, within the container element of the slide (no clue where that means, I'm just interpreting the code for you). If that element exists, then it will be emptied and re-filled with the description.
>
> > node.empty();
> > if (text) {
> > node[0].appendChild(document.createTextNode(text));
> > }
> > }
> > }
> > );
>
> My guess is that you are missing one or more of these antecedents, and without them, the JS won't have anything to work with.
>
> Walter
>
>
> hi, thanks, i dunno what you mean by an empty html element with the classname description, i think you mean <div class="description"> but that's not my view Here's my view:
>
> <div id="links">
> <table>
> <% @profile.pictures.in_groups_of(5, false) do |row_tasks| %>
> <tr>
> <% for task in row_tasks do %>
> <td><a href= "<%= task.name %>" data-description = "<%= task.comment %>" data-gallery ><%= image_tag(task.name.thumb) %></a></td>
> <% end %>
> <% end %>
> </tr>
> </table>
> </div>

Yes, you did get what I meant. Reading through the portion of the script you provided, I can't see where that element needs to be. Perhaps it is added by the lightbox code when it creates the overlay elements. In any case, you have added the correct data attributes to the link, so that part looks right. In the example for the gallery, was there any reference to creating a separate structure in the page html to receive the description? In the documentation, do they have an example page coded in HTML that includes a secondary overlay element or similar? Or is it all generated by the JS code when the page loads?

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+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/ed810211-4222-4a87-978f-bf9942b78193%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/0AA6711A-477D-4BA9-B2FC-CB2D670F7B74%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

On 29 February 2016 at 13:25, fugee ohu <fugee279@gmail.com> wrote:
>
>
> On Monday, February 29, 2016 at 6:44:21 AM UTC-5, Colin Law wrote:
>>
>> On 29 February 2016 at 09:39, fugee ohu <fuge...@gmail.com> wrote:
>> > Using require statements in application.js should reference files
>> > located
>> > where?
>> > //= require bootstrap-sprockets
>> > where is bootstrap-sprockets supposed to be located?
>>
>> If you have included the appropriate gem in Gemfile then you don't
>> need to put it anywhere.
>>
>> Colin
>>
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Ruby on Rails: Talk" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to rubyonrails-ta...@googlegroups.com.
>> > To post to this group, send email to rubyonra...@googlegroups.com.
>> > To view this discussion on the web visit
>> >
>> > https://groups.google.com/d/msgid/rubyonrails-talk/e765dfe2-3dad-459e-adfc-92da95a65d80%40googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>
>
> Thanks, Colin So then why require them if they're all "gemmed out"? I'm
> having trouble getting data-description to work in bluimp-image-gallery If
> you read the docs it can be found under Additional Gallery Elements The
> docs say to include links to javascript scripts at the bottom of my view
> using <script src= ... So that's what I did Seemed the javascript in
> question wasn't working so when I asked for help someone asked me if I was
> using the asset pipeline and then if i'm using the asset pipeline why am i
> putting the links to javascript scripts <script src= ... in my views and the
> discussion ended up concluding just about there after trying to get
> clarification Here's a gist of the files involved
> https://gist.github.com/mices/f9516cb3ea9da3f3c690 ~ thanks, fugee

Not sure what you mean by gemmed out.
I believe that you should either require it in application.js (in
which case it will be compiled in with the other js files) or
specifically include it in the page using the script tag. The former
is generally preferred as it means the browser should only load the js
once for the whole website. I have not used this particular library
though so don't know whether there is a reason why it should be
explicitly loaded in the page.

Google found this which may be helpful
http://stackoverflow.com/questions/21519040/rails-4-bootstrap-set-up-assets

Colin

--
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/CAL%3D0gLusqEBO38xn%2BdVC1fJVZcNCt4_rCpG9M2KeB4vbxy%2Bh5A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails



On Monday, February 29, 2016 at 6:44:21 AM UTC-5, Colin Law wrote:
On 29 February 2016 at 09:39, fugee ohu <fuge...@gmail.com> wrote:
> Using require statements in application.js should reference files located
> where?
> //= require bootstrap-sprockets
> where is bootstrap-sprockets supposed to be located?

If you have included the appropriate gem in Gemfile then you don't
need to put it anywhere.

Colin

>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/e765dfe2-3dad-459e-adfc-92da95a65d80%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Thanks, Colin So then why require them if they're all "gemmed out"? I'm having trouble getting data-description to work in bluimp-image-gallery If you read the docs it can be found  under Additional Gallery Elements The docs say to include links to javascript scripts at the bottom of my view using <script src= ... So that's what I did Seemed the javascript in question wasn't working so when I asked for help someone asked me if I was using the asset pipeline and then if i'm using the asset pipeline why am i putting the links to javascript scripts <script src= ... in my views and the discussion ended up concluding just about there after trying to get clarification Here's a gist of the files involved https://gist.github.com/mices/f9516cb3ea9da3f3c690 ~ thanks, fugee

--
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/c199bbab-f3a5-4f24-a6f8-5c72938fcedc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails



On Monday, February 29, 2016 at 5:13:13 AM UTC-5, nanaya wrote:
Hi

On Mon, Feb 29, 2016, at 18:39, fugee ohu wrote:
> Using require statements in application.js should reference files located
> where?
> //= require bootstrap-sprockets
> where is bootstrap-sprockets supposed to be located?
>

Any of directories in `config.assets.paths`. (can be checked with
`Rails.configuration.assets.paths` from rails console).

I'm sorry yes it does answer my question, somewhat, 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+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/f9d74234-a172-48b4-b4c5-9a05a20f670d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Hi! I'm using the wicked_pdf and I have a problem. The css don't work. How use correctly?

My code is this:

application.html.erb
<!DOCTYPE html>
<html>
<head>
  <title>WickedPdfExample</title>
  <%= wicked_pdf_stylesheet_link_tag "bootstrap.min.css" -%>
  <%= wicked_pdf_stylesheet_link_tag "application.css" -%>
  <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
  <%= csrf_meta_tags %>
</head>
<body>
  <div class="container">
    <%= yield %>
  </div>
</body>
</html>

customers_controller.erb
  def index
    @customers = Customer.all
    respond_to do |format|
      format.html
      format.pdf do
        render :pdf => 'file_name',
        :template => 'customers/index.pdf.erb',
        :show_as_html => params[:debug].present?
      end
    end
  end


index.pdf.erb
<h1>Listing Customers</h1>

<table class="table table-condensed table-bordered">
  <thead>
    <tr>
      <th>Name</th>
      <th>Cpf</th>
      <th>Occupation</th>
    </tr>
  </thead>

  <tbody>
    <% @customers.each do |customer| %>
      <tr>
        <td><%= customer.name %></td>
        <td><%= customer.cpf %></td>
        <td><%= customer.occupation %></td>
      </tr>
    <% end %>
  </tbody>
</table>

And sometimes, get this error:

undefined method `start_with?' for nil:NilClass

What I 'm making wrong?



--
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/43e66f09-363f-41f2-81eb-5cfc54379584%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

On 29 February 2016 at 09:39, fugee ohu <fugee279@gmail.com> wrote:
> Using require statements in application.js should reference files located
> where?
> //= require bootstrap-sprockets
> where is bootstrap-sprockets supposed to be located?

If you have included the appropriate gem in Gemfile then you don't
need to put it anywhere.

Colin

>
> --
> 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/e765dfe2-3dad-459e-adfc-92da95a65d80%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/CAL%3D0gLtG1bm-yuKzRMWLeZC6miW4Vqsed%2BVn2_buD%2BEr0eLKbQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails



On Monday, February 29, 2016 at 5:13:13 AM UTC-5, nanaya wrote:
Hi

On Mon, Feb 29, 2016, at 18:39, fugee ohu wrote:
> Using require statements in application.js should reference files located
> where?
> //= require bootstrap-sprockets
> where is bootstrap-sprockets supposed to be located?
>

Any of directories in `config.assets.paths`. (can be checked with
`Rails.configuration.assets.paths` from rails console).

That doesn't seem to be an answer to my question

--
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/c44c9bcc-44e2-45e7-a949-32e146932aab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Hi

On Mon, Feb 29, 2016, at 18:39, fugee ohu wrote:
> Using require statements in application.js should reference files located
> where?
> //= require bootstrap-sprockets
> where is bootstrap-sprockets supposed to be located?
>

Any of directories in `config.assets.paths`. (can be checked with
`Rails.configuration.assets.paths` from rails console).

--
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/1456740741.1122455.534799122.7D1AA39C%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Using require statements in application.js should reference files located where?
//= require bootstrap-sprockets
where is bootstrap-sprockets supposed to be located?

--
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/e765dfe2-3dad-459e-adfc-92da95a65d80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

On 29 February 2016 at 02:41, Elysee Montissol <lists@ruby-forum.com> wrote:
> I created a simple blog and I'm using paperclip to be able to add images
> to a Post. I installed the 'themify-icons-rails' gem and what I want to
> do is automatically add a picture icon next to the title of a post when
> the post has a image that's been uploaded, to show that the post has a
> image. I'm guessing I would need a If statement somewhere but I'm fairly
> new to rails and I'm not sure where to put it.
>
> <h2 class="ti-gallery"><%= link_to post.title, post %></h2> this adds
> the "Ti-gallery" icon to every post.

Assuming that what you want to leave out is the class specification
and assuming that post.image will be nil if there is no image (replace
that with something similar as necessary)
<h2 <%= "class=/"ti-gallery/"" if post.image %> >
<%= link_to post.title, post %>
</h2>

I have split it onto multiple lines to make it easier to read, that
will not affect the displayed page. The result of the code
"class=/"ti-gallery/"" if post.image
will either be the class= string or nil.

Colin

>
> Any Help will be greatly appreciated, Thank you before hand. Oh and one
> more questions, Is rails Video friendly? i can't seem to find any
> tutorials on uploading videos to a rails app.
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> 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/050fa96f2643c768b05341ba1eefca74%40ruby-forum.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/CAL%3D0gLs%2BS8eSS988_djyfOHHpt7j5dY0FasfeGHM84jArfQY8w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails Sunday, February 28, 2016

Bytes Online Training is the leading training company occupied in provided that on a range of technologies. Bytes Online Training provides wide-ranging training to prepare students to gather their job necessities. Ruby on Rails: Training and Skills to Build Web Applications. Learn to build web apps with Ruby on Rails 4. By the end of the course, you'll be able to use Ruby on Rails to create your own apps. This course explores each part of the framework, best practices, and real-world development techniques. Plus, get hands-on experience by building a complete content management system with dynamic, database-driven content. Kevin teaches how to design an application; route browser requests to return dynamic page content; structure and interact with databases using object-oriented programming; create, update, and delete records; and implement user authentication.


Please call us for the Demo Classes we have regular batches and weekend batches.

Bytes Online Training
Contact Number: USA : 904-304-2519, +1 732-475-4280.
Mail:  contact@bytesonlinetraining.com


--
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/f9d6e06a-acb8-4b8a-8ecb-b05688705d0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Hi everyone,

I have several apps in development using Action Cable on the same server.
They're using the same local redis server.
Usually I use redis-namespace to separate my apps, but I can't find a way to use redis-namespace and cable altogether.

Has anyone a solution to host several apps with action cable on a same server?

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+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/dc059d5f-6594-44fb-ae5f-f0adca512c4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

I'm new in Rails.

I'm trying to add a form with ajax.It's just typing a text and submit to
file 'ex/act' and show the param in form.

My code:

<script>
function loadDoc(url, cfunc) {
var xhttp;
xhttp=new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4 && xhttp.status == 200) {
cfunc(xhttp);
}
};
xhttp.open("POST", url, true);
xhttp.send();
}
function myFunction(xhttp) {
document.getElementById("demo").innerHTML = xhttp.responseText;
}
</script>

And the form:

<%= form_for :ex,url:ex_act_path,remote:true do |f|%>
<%= f.text_field :text%>
<button onclick="loadDoc('ex/act',myFunction)">abc</button>
<%end%>

In the 'ex/act' controller:

def act
@a = get_param
end
private
def get_param
params.require(:ex).permit(:text)
end

In the Console of browser:

POST http://localhost:3000/ex/act 422 Unprocessable Entity
GET http://localhost:3000/ex/act 200 OK

--
Posted via http://www.ruby-forum.com/.

--
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/befb8748915a530c9f2e920b494f844c%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

I created a simple blog and I'm using paperclip to be able to add images
to a Post. I installed the 'themify-icons-rails' gem and what I want to
do is automatically add a picture icon next to the title of a post when
the post has a image that's been uploaded, to show that the post has a
image. I'm guessing I would need a If statement somewhere but I'm fairly
new to rails and I'm not sure where to put it.

<h2 class="ti-gallery"><%= link_to post.title, post %></h2> this adds
the "Ti-gallery" icon to every post.

Any Help will be greatly appreciated, Thank you before hand. Oh and one
more questions, Is rails Video friendly? i can't seem to find any
tutorials on uploading videos to a rails app.

--
Posted via http://www.ruby-forum.com/.

--
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/050fa96f2643c768b05341ba1eefca74%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails



On Sunday, February 28, 2016 at 3:01:35 PM UTC-5, Walter Lee Davis wrote:

> On Feb 28, 2016, at 12:36 PM, fugee ohu <fuge...@gmail.com> wrote:
>
>
>
> On Sunday, February 28, 2016 at 8:51:51 AM UTC-5, Colin Law wrote:
> On 28 February 2016 at 11:44, fugee ohu <fuge...@gmail.com> wrote:
> > Why is adding descriptions a whole javascript task in bluimp image gallery
> > Couldn't the author have worked it out so that all I'd have to do is provide
> > the descriptions in the html They provide a data-description option to use
> > in my html anchor containers but that doesn't do anything by itself without
> > having to do a significant little bit of js coding Makes me wonder if
> > there's something better than bluimp This is a real bummer as we used to say
>
> Or to rephrase your question:
>
> Bluimp is a great gem which does almost exactly what I want and I am
> very grateful to the authors for allowing me to benefit from their
> work.  There is one little feature missing so I think I will fork
> their code and add that feature and send a pull request back to the
> authors so it can be added to the gem and the whole community may
> benefit.  Googling for
> adding descriptions to images displayed in bluimp image gallery
> shows a number of good hits so I don't it should be too difficult.
>
> Colin
>  
>  Here's the code they provide, I tried but it doesn't have any effect so far
>
>  blueimp.Gallery(
>     document.getElementById('links'),
>     {
>         onslide: function (index, slide) {
>             var text = this.list[index].getAttribute('data-description'),

For the preceding line to work, your element needs to have the attribute data-description on it. Does it?

>                 node = this.container.find('.description');

For the preceding line to work, you need to have an empty HTML element with the classname description present in the page, within the container element of the slide (no clue where that means, I'm just interpreting the code for you). If that element exists, then it will be emptied and re-filled with the description.

>             node.empty();
>             if (text) {
>                 node[0].appendChild(document.createTextNode(text));
>             }
>         }
>     }
> );

My guess is that you are missing one or more of these antecedents, and without them, the JS won't have anything to work with.

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-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/395919ba-62b9-46a1-b3be-b4e2ba84f63c%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

hi, thanks, i dunno what you mean by an empty html element with the classname description, i think you mean <div class="description"> but that's not my view Here's my view:
 
<div id="links">
 <table>
 <% @profile.pictures.in_groups_of(5, false) do |row_tasks| %>
  <tr>
   <% for task in row_tasks do %>
    <td><a href= "<%= task.name %>" data-description = "<%= task.comment %>" data-gallery ><%= image_tag(task.name.thumb) %></a></td>
   <% end %>
  <% end %>
  </tr>
 </table>
</div>

--
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/ed810211-4222-4a87-978f-bf9942b78193%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails



On Sunday, February 28, 2016 at 4:41:28 AM UTC-5, Colin Law wrote:
On 28 February 2016 at 04:37, fugee ohu <fuge...@gmail.com> wrote:
> ..
> Hi again and thanks again Tam I got it working like this
>  <td><a href= "<%= task.name %>"><%= image_tag(task.name.thumb) %></a></td>
>

Unless I am missing something, this might be clearer
<td>
  <%= link_to image_tag(task.name.thumb), task.name %>
</td>

Colin

thank you

--
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/0b34b075-5f4d-4117-ad0d-48e6d10e53e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails



On Saturday, February 27, 2016 at 11:08:35 PM UTC-5, tamouse wrote:

On Sat, Feb 27, 2016 at 9:14 PM, fugee ohu <fuge...@gmail.com> wrote:

> I'm trying to build some links from this statement   <% for task in
> row_tasks %> where  task.name and task.name.thumb are full path image
> file names and not having any luck

> I've been trying to link to the image from the thumb I've tried with
> helpers and basic html something like this ... <a href =
> "#{@image_path}" ><%= image_tag("#{@thumb_path}") %></a> and i've
> tried the same with link_to image_tag How am i gonna do this?

This should work I would think, given what you say above:

<% for task in row_tasks do %>
<a href="<%= image_tag(task.name)%>"><%= image_path(task.name.thumb) %></a>
<% end %>


--
Tamara Temple
tam...@gmail.com
http://www.tamouse.org

thank you

--
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/1687875c-634e-467b-a9c7-fc5d403b2af4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.