Activity
@Mvondo, sounds like you forgot to add the capistrano-rails gem to your Gemfile.
That is easy enough! Protip is you can use the index
method to find the index integer quickly and simplify this a bit:
irb(main):001:0> ["a", "b", "c"].index("a")
=> 0
irb(main):002:0> ["a", "b", "c"].index("c")
=> 2
So like:
def index_based_on_controller(controller)
["user_books", "user_books/want_to_read", "user_books/reading_now", ... etc ].index(controller)
end
If you set the data index attribute in the HTML when you render the page, that tab will be pre-selected. You'll just have to use a helper in Rails to check the anchor and see if it matches a tab to set the index.
We need to add some code to the code so it can automatically select the index for you when the page loads with a matching anchor still. 👍
I would just put a before_action
on all the controllers that directs away if they aren't subscribed. Nice and simple.
Yeah, that's the main argument for using cookies. They can't be stolen easily because the browser secure them. It also introduces some annoyances building services with iframes and things. CORS is confusing, but may be able to solve your problems with cookies. JWTs have to be stored in LocalStorage and that means they aren't really stored securely if Javascript can access it.
There's nothing builtin to Rails to read or write option1
or option2
directly.
You can assign a hash to something_here
and it will work just fine though so you can write your own helper method to read from that, just have to assign the hash though when you want to change it.
Posted in New Design!
Tailwind has made design changes SO easy. It's definitely been my favorite tool I've started using in the last year.
Hey Tim! I love that idea. I could see this being useful for Jumpstart Pro users. 👍 I'll leave a note on the GitHub issue for other people to find.
Posted in New Design!
Thanks Nick! That means a lot. I give TailwindCSS most all the credit for this new design. They have done a phenomenal job with their templates.
Yup, definitely want to hide that navigation if you're using this for real. :)
Should be pretty easy. Once the AJAX request succeeds, you can update the URL with a pushState. I would imagine you'd want pushState so you don't clobber the previous URL and it would keep the history as if you clicked each link. 👍
I bet this could be a great way to improve that. 👍
You're exactly right. If you send them over as an array, Rails can just loop through the array in the params and create them all one-by-one.
Then you just have to decide how you want to handle errors. Some cases you may want to cancel everything if one fails and return the error as JSON, or return JSON with two arrays of the successful and unsuccessful creates. Depends on what you need really.
Ryan Bates made a Railscast on this way back when I guess. http://railscasts.com/episodes/414-batch-api-requests I might have to do something similar in a future episode. 👍
Looks like we've discussed this in the past here actually! https://gorails.com/forum/stripe-subscription-with-initial-setup-fee
Seems that you simply add the setup fee to the initial invoice of the subscription and future payments will just be the normal plan price. https://support.stripe.com/questions/add-a-one-time-fee-or-discount-with-a-new-subscription-plan
If you link to the page the post is on, you can set the anchor in the link to to scroll down to the comment.
For example, your post here has an anchor on it:
https://gorails.com/forum/question-regarding-the-threaded-comments-post-titles-or-link_to-post-only-if-the-current-user-is-on-another-users-show-page#forum_post_16256
You would link to post_path(comment.post, anchor: dom_id(comment))
which is basically what I'm doing, but mine are called forum threads and forum posts here on GoRails.
Posted in How do you handle the Sitemap for a user generated content website like a social media network?
As long as the page is linked somewhere, Google will usually find and index it automatically, so you may not need to do this as
You could probably use the sitemap_generator gem to create sitemaps and point Google to it. https://github.com/kjvarga/sitemap_generator
Try using the simple_format
helper. https://apidock.com/rails/ActionView/Helpers/TextHelper/simple_format
Posted in Import into administrate?
You're welcome! Glad that worked out pretty easily!
Posted in Import into administrate?
The error sounds like you maybe didn't pass in a URL properly in somewhere. Print out the row["coverphoto"]
to make sure it's a valid URL.
Also you should change the line to this:
stadium = Stadium.create(name: row["name"],city: row["city"], image_remote_url: row["coverphoto"])
That will let Shrine handle it seamlessly for you.
You can use request.domain
to check the current domain and query your database for the account & logo you need to show.